public void ShouldPopulateReferencesDefinedSeparately() { var contractDictionary = new CaseInsensitiveDictionary <SchemaObject> { { "Contract", new SchemaObject { Type = "Object" } }, { "Custom", new SchemaObject { Type = "String", Example = "Custom example" } } }; contractDictionary["Contract"].Properties = new CaseInsensitiveDictionary <SchemaObject> { { "Test", new SchemaObject { Reference = "#/Custom" } }, }; var result = SchemaObject.PopulateReferences(contractDictionary); result.HasReferenceError.ShouldBeFalse(); result.SchemaDictionary["Contract"].Properties["Test"].Type.ShouldBe("String"); result.SchemaDictionary["Contract"].Properties["Test"].Example.ShouldBe("Custom example"); }
public void ShouldHaveErrorWhenReferenceNotDefined() { var contractDictionary = new CaseInsensitiveDictionary <SchemaObject> { { "Contract", new SchemaObject { Type = "Object" } } }; contractDictionary["Contract"].Properties = new CaseInsensitiveDictionary <SchemaObject> { { "Test", new SchemaObject { Reference = "#/Custom" } }, }; var result = SchemaObject.PopulateReferences(contractDictionary); result.HasReferenceError.ShouldBeTrue(); }