Пример #1
0
        public void WhenTextIsWrittenItAppearsInTheFile()
        {
            // ARRANGE
            Prepender p = new Prepender("hello, how are you?");

            File.Delete("moo.txt");
            // ACT
            p.Prepend("moo.txt");
            // ASSERT
            Assert.AreEqual("hello, how are you?\r\n", File.ReadAllText("moo.txt"), "The value should be prepended to the file");
        }
Пример #2
0
        public void WhenTextIsWrittenTwiceItIsPrepended()
        {
            // ARRANGE
            Prepender p = new Prepender("hello, how are you?");
            Prepender q = new Prepender("Hi there!");

            File.Delete("moo.txt");
            // ACT
            p.Prepend("moo.txt");
            q.Prepend("Moo.txt");
            // ASSERT
            Assert.AreEqual("Hi there!\r\nhello, how are you?\r\n", File.ReadAllText("moo.txt"), "Two values should be prepended");
        }