public void CreateClassSingle() { var empty = new List <ISchemaDecorator>(0); var schemaGen = new SchemaGenerator(empty); MockSchema schema = new MockSchema { Id = "mockSchemaObject", Name = "mockSchemaObject", SchemaDetails = MockSchema.CreateSimpleSchema("mockSchemaObject") }; var typeDeclaration = schemaGen.CreateClass( schema, new Dictionary <JsonSchema, SchemaImplementationDetails>(), Enumerable.Empty <string>()); Assert.IsNotNull(typeDeclaration); Assert.AreEqual("MockSchemaObject", typeDeclaration.Name); Assert.IsEmpty(typeDeclaration.Members); }
public void CreateClassWithSingleDecorator() { var oneDecorator = new List <ISchemaDecorator>(1) { new CountingDecorator() }; var schemaGen = new SchemaGenerator(oneDecorator); MockSchema schema = new MockSchema { Id = "mockSchemaObject", Name = "mockSchemaObject", SchemaDetails = MockSchema.CreateSimpleSchema("mockSchemaObject") }; schemaGen.CreateClass( schema, new Dictionary <JsonSchema, SchemaImplementationDetails>(), Enumerable.Empty <string>()); Assert.AreEqual(1, ((CountingDecorator)oneDecorator[0]).Count); }
public void CreateClassWithMultipleDecorators() { var once = new CountingDecorator(); var threeTimes = new CountingDecorator(); var decorators = new List <ISchemaDecorator>(4) { once, threeTimes, threeTimes, threeTimes }; var schemaGen = new SchemaGenerator(decorators); MockSchema schema = new MockSchema { Id = "mockSchemaObject", Name = "mockSchemaObject", SchemaDetails = MockSchema.CreateSimpleSchema("mockSchemaObject") }; schemaGen.CreateClass( schema, new Dictionary <JsonSchema, SchemaImplementationDetails>(), Enumerable.Empty <string>()); Assert.AreEqual(1, ((CountingDecorator)decorators[0]).Count); Assert.AreEqual(3, ((CountingDecorator)decorators[1]).Count); Assert.AreEqual(3, ((CountingDecorator)decorators[2]).Count); Assert.AreEqual(3, ((CountingDecorator)decorators[3]).Count); }