ToString() public method

Gets the text of all events.
public ToString ( ) : string
return string
Ejemplo n.º 1
0
        public void ArrangeDirectoryTest()
        {
            string testSourceParentDirectory = Path.Combine(Path.GetTempPath(), "TestSource");
            string testSourceChildDirectory = Path.Combine(testSourceParentDirectory, "Child");

            try
            {
                try
                {
                    Directory.CreateDirectory(testSourceParentDirectory);
                }
                catch
                {
                }

                try
                {
                    Directory.CreateDirectory(testSourceChildDirectory);
                }
                catch
                {
                }

                File.Copy(
                    _testValidSourceFile1,
                    Path.Combine(testSourceParentDirectory, Path.GetFileName(_testValidSourceFile1)),
                    true);

                File.Copy(
                    _testValidSourceFile2,
                    Path.Combine(testSourceParentDirectory, Path.GetFileName(_testValidSourceFile2)),
                    true);

                File.Copy(
                    _testValidSourceFile1,
                    Path.Combine(testSourceChildDirectory, Path.GetFileName(_testValidSourceFile1)),
                    true);

                File.Copy(
                    _testValidSourceFile2,
                    Path.Combine(testSourceChildDirectory, Path.GetFileName(_testValidSourceFile2)),
                    true);

                TestLogger logger = new TestLogger();
                FileArranger fileArranger = new FileArranger(null, logger);

                bool success = fileArranger.Arrange(testSourceParentDirectory, null);

                string log = logger.ToString();
                Assert.IsTrue(success, "Expected directory to be arranged succesfully - " + log);
                Assert.IsTrue(
                    logger.HasMessage(LogLevel.Verbose, "4 files written."),
                    "Expected 4 files to be written - " + log);
            }
            finally
            {
                try
                {
                    Directory.Delete(testSourceParentDirectory, true);
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 2
0
        public void ArrangeUTF8EncodedSourceFileTest()
        {
            TestLogger logger = new TestLogger();
            FileArranger fileArranger = new FileArranger(null, logger);

            bool success = fileArranger.Arrange(_testUTF8File, null);

            Assert.IsTrue(success, "Expected file to be arranged succesfully. - " + logger.ToString());
            Assert.IsTrue(
                logger.HasMessage(LogLevel.Verbose, "1 files written."),
                "Expected 1 file to be written. - " + logger.ToString());

            string originalContents = GetTestFileContents("UTF8.cs", Encoding.UTF8);
            originalContents = originalContents.Replace("#endregion", "#endregion Fields");
            Assert.AreEqual(originalContents, File.ReadAllText(_testUTF8File, Encoding.UTF8), "File contents should have been preserved.");
        }
Ejemplo n.º 3
0
        public void ArrangeSolutionTest()
        {
            TestLogger logger = new TestLogger();
            FileArranger fileArranger = new FileArranger(null, logger);

            bool success = fileArranger.Arrange(_testSolutionFile, null);

            Assert.IsTrue(success, "Expected file to be arranged succesfully.");
            Assert.IsTrue(
                logger.HasMessage(LogLevel.Verbose, "2 files written."),
                "Expected 2 files to be written. - " + logger.ToString());
        }
Ejemplo n.º 4
0
        public void ArrangeProjectFilteredTest()
        {
            CodeConfiguration filterProjectConfig = CodeConfiguration.Default.Clone() as CodeConfiguration;

            // Set up the filter
            FilterBy filter = new FilterBy();
            filter.Condition = "!($(File.Path) : '.Filtered.')";
            ((ProjectHandlerConfiguration)filterProjectConfig.Handlers[0]).ProjectExtensions[0].FilterBy = filter;

            string filterProjectConfigFile = Path.Combine(Path.GetTempPath(), "FilterProjectConfig.xml");

            try
            {
                filterProjectConfig.Save(filterProjectConfigFile);

                TestLogger logger = new TestLogger();
                FileArranger fileArranger = new FileArranger(filterProjectConfigFile, logger);

                bool success = fileArranger.Arrange(_testFilteredProjectFile, null);

                Assert.IsTrue(success, "Expected file to be arranged succesfully.");
                Assert.IsTrue(
                    logger.HasMessage(LogLevel.Verbose, "0 files written."),
                    "Expected 0 files to be written - " + logger.ToString());
            }
            finally
            {
                try
                {
                    File.Delete(filterProjectConfigFile);
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 5
0
        public void ArrangeDirectoryEmptyTest()
        {
            string testSourceParentDirectory = Path.Combine(Path.GetTempPath(), "TestSource");

            try
            {
                try
                {
                    Directory.CreateDirectory(testSourceParentDirectory);
                }
                catch
                {
                }

                TestLogger logger = new TestLogger();
                bool success = Arrange(logger, testSourceParentDirectory);

                string log = logger.ToString();
                Assert.IsTrue(success, "Expected directory to be arranged succesfully - " + log);
                Assert.IsTrue(
                    logger.HasMessage(LogLevel.Verbose, "0 files written."),
                    "Expected 0 files to be written - " + log);
            }
            finally
            {
                try
                {
                    Directory.Delete(testSourceParentDirectory, true);
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 6
0
        public void ArrangeMSBuildSolutionTest()
        {
            TestLogger logger = new TestLogger();

            bool success = Arrange(logger, _testMSBuildSolutionFile);

            Assert.IsTrue(success, "Expected file to be arranged succesfully - {0}", logger.ToString());
            Assert.IsTrue(logger.HasMessage(LogLevel.Verbose, "2 files written."), logger.ToString());
        }