Esempio n. 1
0
            public void GetClassNameWithoutDetailsTest()
            {
                var empty = new List <ISchemaDecorator>(0);
                var decl  = new CodeTypeDeclaration()
                {
                    Name = "Top"
                };
                var gen = new SchemaGenerator.NestedClassGenerator(decl, empty, "1_");

                var schema1 = new JsonSchema();

                Assert.AreEqual("Top.NestedClass1_1", gen.GetClassName(schema1, null).BaseType);
                Assert.AreEqual("Top.NestedClass1_1", gen.GetClassName(schema1, null).BaseType);
                Assert.AreEqual("Top.NestedClass1_2", gen.GetClassName(new JsonSchema(), null).BaseType);
            }
Esempio n. 2
0
            public void GetClassNameWithDetailsCollisionsTest()
            {
                var empty = new List <ISchemaDecorator>(0);
                var decl  = new CodeTypeDeclaration()
                {
                    Name = "Top"
                };
                var gen = new SchemaGenerator.NestedClassGenerator(decl, empty, "1_");

                var schema1 = new JsonSchema();
                var schema2 = new JsonSchema();
                var details = new SchemaImplementationDetails()
                {
                    ProposedName = "TestClass"
                };

                Assert.AreEqual("Top.TestClass", gen.GetClassName(schema1, details).BaseType);
                Assert.AreNotEqual("Top.TestClass", gen.GetClassName(schema2, details).BaseType);
            }