public void Build() { ValidateSchema(); var schemaRequiredFields = requiredFieldFactory.GetRequiredFields(message.GetType()); var schema = new AgreementSchema(providerName, consumerName, description, metaData, message, schemaRequiredFields); agreementRecorder.Record(schema); }
public void schema_should_support_generic_collections_of_complex_types() { var msg = new TypeWithComplexTypeWithGenericCollectionOfComplexTypes { }; var factory = new RequiredFieldFactory(); var expectedRequiredField = new ComplexCollectionRequiredField( name: "GenericOfComplex", level: 1, type: TypesNamesConsts.CollectionOf + "NestedComplexType", requiredFields: factory.GetRequiredFields(typeof(NestedComplexType)) ); factory.GetRequiredFields(msg.GetType()).ShouldContainEquivalentTo(expectedRequiredField, helper); }
public void Verify() { ValidateVerifier(); var schemaRequiredFields = requiredFieldFactory.GetRequiredFields(message.GetType()); var provierSchema = new AgreementSchema(providerName, consumerName, description, metaData, message, schemaRequiredFields); var consumerSchema = agreementReader.Read(); provierSchema.Equals(consumerSchema); }
public void schema_should_support_complex_types_specific_fields() { var message = new SomeMessage(); var factory = new RequiredFieldFactory(); var fields = factory.GetRequiredFields(new { message.SomeClass }.GetType()); fields.Should().HaveCount(3); fields.Should().Contain(new ClassRequiredField("SomeClass", 0, "SomeClass")); }
public void schema_should_support_generic_collections_of_key_value_pair() { var msg = new NestedKeyValuePairCollection { }; var factory = new RequiredFieldFactory(); var expectedRequiredField = new ComplexCollectionRequiredField( name: "TypeWithNestedColletionKeyValue", level: 0, type: TypesNamesConsts.CollectionOf + "KeyValuePair`2", requiredFields: factory.GetRequiredFields(typeof(KeyValuePair <string, ValueDictionaryType>)) ); var result = factory.GetRequiredFields(msg.GetType()); result.ShouldContainEquivalentTo(expectedRequiredField, helper); ((ComplexCollectionRequiredField)result.Single()).RequiredFields.Should().BeEquivalentTo(expectedRequiredField.RequiredFields); }
public void schema_should_support_simple_collections_specific_fields() { var message = new SomeMessage(); var factory = new RequiredFieldFactory(); var fields = factory.GetRequiredFields(new { message.DatesProperty }.GetType()); fields.Should().HaveCount(1); fields.Should().Contain(new SimpleCollectionRequiredField("DatesProperty", 0, TypesNamesConsts.CollectionOf + "System.DateTime")); }
public void schema_should_support_dictionaries_with_simple_key_and_collection_value() { var msg = new TypeWithDictionaryWithSimpleKeyCollectionValue(); var factory = new RequiredFieldFactory(); var expectedRequiredField = new DictionaryRequiredField( name: "SimpleKeyCollectionValue", level: 0, type: string.Format(TypesNamesConsts.DictionaryOf, "System.Int32", TypesNamesConsts.CollectionOf + "ValueDictionaryType"), keyFields: new ISchemaRequiredField[] { new SimpleRequiredField(TypesNamesConsts.DictionaryKeyName, 0, "System.Int32") }, valueFields: factory.GetRequiredFields(typeof(ValueDictionaryType)) ); var result = factory.GetRequiredFields(msg.GetType()); result.ShouldContainEquivalentTo(expectedRequiredField, helper); ((DictionaryRequiredField)result.Single()).KeyFields.Should().BeEquivalentTo(expectedRequiredField.KeyFields); ((DictionaryRequiredField)result.Single()).ValueFields.Should().BeEquivalentTo(expectedRequiredField.ValueFields); }
public void schema_should_support_simple_types_specific_fields() { var message = new SomeMessage(); var factory = new RequiredFieldFactory(); var fields = factory.GetRequiredFields(new { message.DateProperty, message.IntProperty }.GetType()); fields.Should().HaveCount(2); fields.Should().Contain(new SimpleRequiredField("IntProperty", 0, "System.Int32")); fields.Should().Contain(new SimpleRequiredField("DateProperty", 0, "System.DateTime")); }
public void schema_should_contains_byte_field() { var msg = new SimpleTypesTestMessage { BoolProperty = true }; var factory = new RequiredFieldFactory(); var expectedRequiredField = new SimpleRequiredField(name: "ByteProperty", level: 0, type: "System.Byte"); factory.GetRequiredFields(msg.GetType()).ShouldContainEquivalentTo(expectedRequiredField, helper); }
public void schema_should_contains_datetime_field() { var msg = new SimpleTypesTestMessage { DateTimeProperty = DateTime.Now }; var factory = new RequiredFieldFactory(); var expectedRequiredField = new SimpleRequiredField(name: "DateTimeProperty", level: 0, type: "System.DateTime"); factory.GetRequiredFields(msg.GetType()).ShouldContainEquivalentTo(expectedRequiredField, helper); }
public void schema_should_contains_string_field() { var msg = new SimpleTypesTestMessage { IntTestProperty = 100 }; var factory = new RequiredFieldFactory(); var expectedRequiredField = new SimpleRequiredField(name: "StringProperty", level: 0, type: "System.String"); factory.GetRequiredFields(msg.GetType()).ShouldContainEquivalentTo(expectedRequiredField, helper); }
public void schema_should_contains_collection_of_simple_types() { var msg = new SimpleCollectionTypes { }; var factory = new RequiredFieldFactory(); var expectedRequiredField = new SimpleCollectionRequiredField(name: "CollectionOfInts", level: 0, type: TypesNamesConsts.CollectionOf + "System.Int32"); factory.GetRequiredFields(msg.GetType()).ShouldContainEquivalentTo(expectedRequiredField, helper); }
public void schema_should_contains_collection_of_simple_types_on_level_one() { var msg = new TestMessageClass { }; var factory = new RequiredFieldFactory(); var expectedRequiredField = new SimpleCollectionRequiredField(name: "CollectionOfBytes", level: 1, type: TypesNamesConsts.CollectionOf + "System.Byte"); factory.GetRequiredFields(msg.GetType()).ShouldContainEquivalentTo(expectedRequiredField, helper); }
public void schema_should_contains_simple_type_on_level_one_when_complex_type_exists() { var factory = new RequiredFieldFactory(); var msg = new SimpleWithComplexTypeTestMessage { FirstNestedComplexType = new FirstNestedComplexType() }; var expectedRequiredField = new SimpleRequiredField(name: "StringProperty", level: 0, type: "System.String"); factory.GetRequiredFields(msg.GetType()).ShouldContainEquivalentTo(expectedRequiredField, helper); }
public void schema_should_contains_collection_of_complex_types_with_nested_collection_of_types() { var msg = new ComplexTypeInCollectionWithNestedCollection { }; var factory = new RequiredFieldFactory(); var expectedRequiredField = new ComplexCollectionRequiredField(name: "CollectionWithNestedColletion", level: 0, type: TypesNamesConsts.CollectionOf + "TypeWithNestedColletion", requiredFields: factory.GetRequiredFields(typeof(TypeWithNestedColletion))); factory.GetRequiredFields(msg.GetType()).ShouldContainEquivalentTo(expectedRequiredField, helper); }
public void schema_should_contains_simple_type_on_level_two() { var factory = new RequiredFieldFactory(); var msg = new SimpleWithComplexTypeTestMessage { FirstNestedComplexType = new FirstNestedComplexType { ThirdNestedComplexType = new ThirdNestedComplexType() } }; var expectedRequiredField = new SimpleRequiredField(name: "ThirdNestedDateTimeProperty", level: 2, type: "System.DateTime"); factory.GetRequiredFields(msg.GetType()).ShouldContainEquivalentTo(expectedRequiredField, helper); }
public void schema_should_support_generic_collections_of_simple_types() { var msg = new TypeWithComplexTypeWithGenericCollectionOfSimpleTypes { }; var factory = new RequiredFieldFactory(); var expectedRequiredField = new SimpleCollectionRequiredField(name: "GenericOfSimples", level: 1, type: TypesNamesConsts.CollectionOf + "System.Int32" ); factory.GetRequiredFields(msg.GetType()).ShouldContainEquivalentTo(expectedRequiredField, helper); }
public void schema_should_contains_complex_type() { var factory = new RequiredFieldFactory(); var msg = new SimpleWithComplexTypeTestMessage { FirstNestedComplexType = new FirstNestedComplexType { FirstBoolProperty = true, FirstStringProperty = "NestedString" } }; var expectedRequiredField = new ClassRequiredField(name: "FirstNestedComplexType", level: 0, type: "FirstNestedComplexType"); factory.GetRequiredFields(msg.GetType()).ShouldContainEquivalentTo(expectedRequiredField, helper); }