Ejemplo n.º 1
0
        public void SimpleExportedInterfaceGeneratorTest()
        {
            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.GenerateInterface(@class, true, false);

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