Esempio n. 1
0
        public void TestFileWithManyComponentOfDifferentTypesInterleaved()
        {
            // arrange
            var typescriptFile =
                new TypeScriptFile
            {
                Contents = new List <TypeScriptDeclarationOrStatement>
                {
                    new Mocks.TypeScriptDeclarationOrStatementMock1("componentT1A;"),
                    new Mocks.TypeScriptDeclarationOrStatementMock2("componentT2A;"),
                    new Mocks.TypeScriptDeclarationOrStatementMock1("componentT1B;")
                }
            };
            var expectedOutput =
                "componentT1A;" + Environment.NewLine +
                Environment.NewLine +
                "componentT2A;" + Environment.NewLine +
                Environment.NewLine +
                "componentT1B;" + Environment.NewLine;
            var actualOutput = new StringWriter();

            // act
            typescriptFile.Generate(actualOutput);

            // assert
            Assert.Equal(expectedOutput, actualOutput.ToString());
        }
Esempio n. 2
0
        public void TestEmptyFile()
        {
            // arrange
            var typescriptFile = new TypeScriptFile();
            var expectedOutput = "";
            var actualOutput   = new StringWriter();

            // act
            typescriptFile.Generate(actualOutput);

            // assert
            Assert.Equal(expectedOutput, actualOutput.ToString());
        }
Esempio n. 3
0
        public void TestFileWithOneComponent()
        {
            // arrange
            var typescriptFile =
                new TypeScriptFile
            {
                Contents = new List <TypeScriptDeclarationOrStatement>
                {
                    new Mocks.TypeScriptDeclarationOrStatementMock1("component1;")
                }
            };
            var expectedOutput = "component1;" + Environment.NewLine;
            var actualOutput   = new StringWriter();

            // act
            typescriptFile.Generate(actualOutput);

            // assert
            Assert.Equal(expectedOutput, actualOutput.ToString());
        }