Example #1
0
        public void CreateSln_VerifyValidFormat()
        {
            // arrange
            string path = @"F:\Temp\test.sln";

            Core.SlnBuilder sb = new Core.SlnBuilder();
            // act
            sb.WriteSolution(path);
            // assert
            // TODO
            XmlTextReader reader = new XmlTextReader(path);

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:     // The node is an element.
                    Console.Write("<" + reader.Name);
                    Console.WriteLine(">");
                    break;

                case XmlNodeType.Text:     //Display the text in each element.
                    Console.WriteLine(reader.Value);
                    break;

                case XmlNodeType.EndElement:     //Display the end of the element.
                    Console.Write("</" + reader.Name);
                    Console.WriteLine(">");
                    break;
                }
            }
        }
Example #2
0
        public void CreateSln_ExceptionIfSlnReadOnly()
        {
            string path = CreateTestSln();

            File.SetAttributes(path, FileAttributes.ReadOnly);
            Core.SlnBuilder sb = new Core.SlnBuilder();
            sb.WriteSolution(path);
        }
Example #3
0
        public void CreateSln_OverrideIfExists()
        {
            // arrange
            string path = CreateTestSln();

            Core.SlnBuilder sb = new Core.SlnBuilder();
            DateTime        oldCreationTime = File.GetLastWriteTime(path);

            // act
            System.Threading.Thread.Sleep(50);
            sb.WriteSolution(path);
            // assert
            DateTime creationTime = File.GetLastWriteTime(path);

            Assert.IsFalse(DateTime.Compare(oldCreationTime, creationTime) == 0);
        }