Esempio n. 1
0
        public void TestExportDefaultObject()
        {
            // arrange
            var exportStatement = new TypeScriptExportStatement {
                Object = "Invoice", IsDefault = true
            };
            var outputWriter   = new StringWriter();
            var expectedOutput = @"export default Invoice;" + Environment.NewLine;

            // act
            exportStatement.Generate(outputWriter);

            // assert
            Assert.Equal(expectedOutput, outputWriter.ToString());
        }
Esempio n. 2
0
        public void TestExportDefaultTypeDeclaration()
        {
            // arrange
            var typeDeclaration = new TypeScriptClass {
                Name = "Invoice"
            };
            var exportStatement = new TypeScriptExportStatement {
                TypeDeclaration = typeDeclaration, IsDefault = true
            };
            var outputWriter         = new StringWriter();
            var expectedOutputWriter = new StringWriter();

            expectedOutputWriter.Write("export default ");
            typeDeclaration.Generate(expectedOutputWriter);

            // act
            exportStatement.Generate(outputWriter);

            // assert
            Assert.Equal(expectedOutputWriter.ToString(), outputWriter.ToString());
        }