use atelier_core::builder::{ModelBuilder, SimpleShapeBuilder, StructureBuilder};
use atelier_core::io::lines::make_line_oriented_form;
use atelier_core::model::Model;
use atelier_core::Version;
use pretty_assertions::assert_eq;
use std::convert::TryInto;
const EXPECTED_LINES: &[&str] = &[
"boolean::smithy.example#MyBoolean",
"string::smithy.example#MyString",
"structure::smithy.example#MyStructure",
"structure::smithy.example#MyStructure::a=>smithy.example#MyString",
"structure::smithy.example#MyStructure::b=>smithy.example#MyString",
"structure::smithy.example#MyStructure::c=>foo.baz#Bar",
"structure::smithy.example#MyStructure::d=>smithy.api#String",
"structure::smithy.example#MyStructure::e=>smithy.example#MyBoolean",
"structure::smithy.example#MyStructure::f=>smithy.example#InvalidShape",
"unresolved::foo.baz#Bar",
"unresolved::smithy.example#InvalidShape",
];
#[test]
fn test_shapeid_resolution_valid() {
let model: Model = ModelBuilder::new(Version::V10, "smithy.example")
.uses("foo.baz#Bar")
.simple_shape(SimpleShapeBuilder::string("MyString"))
.structure(
StructureBuilder::new("MyStructure")
.member("a", "MyString")
.member("b", "smithy.example#MyString")
.member("c", "Bar")
.member("d", "String")
.member("e", "MyBoolean")
.member("f", "InvalidShape")
.into(),
)
.simple_shape(SimpleShapeBuilder::boolean("MyBoolean"))
.try_into()
.unwrap();
assert!(!model.is_complete());
let lines = make_line_oriented_form(&model);
println!("{:#?}", lines);
assert_eq!(lines, EXPECTED_LINES);
}