예제 #1
0
        public void SimpleClassGeneratorTest()
        {
            Class @class = new Class
            {
                Name       = "Some",
                Properties = new[]
                {
                    new Property
                    {
                        Name   = "Prop",
                        CsType = null,
                    }
                }
            };

            ICsToTsTypeConverter typeConverter = Substitute.For <ICsToTsTypeConverter>();

            typeConverter.GetTypeScriptType(null).Returns("");

            TsGenerator generator = new TsGenerator(typeConverter);

            string generatedCode = generator.GenerateClass(@class, false);

            generatedCode.Should().Contain("Some", "because this is the class name");
            generatedCode.Should().Contain("class", "because we are generating an interface");
            generatedCode.Should().Contain("Prop:", "because that is the name op the property");
            generatedCode.Should().NotContain("export", "because export is false");
        }