Example #1
0
            public void WhenFileIsEmpty_ThenReplaceNothing()
            {
                var sut = FileBuilder.InFileSystem.WithPath(GetAbsolutePath("ReplaceLine1.txt")).Build();

                var result = sut.ReplaceLine(1, "New Line 1", GetAbsolutePath("ReplaceLine1-Output.txt"));

                AssertFile.IsEmpty(result);
            }
Example #2
0
            public void WhenFileHasOneLine_ThenDeleteLine()
            {
                var sut = FileBuilder.InFileSystem.WithText("Line 1").WithPath(GetAbsolutePath("DeleteLastLine2.txt")).Build();

                var result = sut.DeleteLastLine(GetAbsolutePath("DeleteLastLine2-Output.txt"));

                AssertFile.IsEmpty(result);
            }
Example #3
0
            public void WhenFileIsEmpty_ThenDeleteNothing()
            {
                var sut = FileBuilder.InFileSystem.WithPath(GetAbsolutePath("DeleteLastLine1.txt")).Build();

                var result = sut.DeleteLastLine(GetAbsolutePath("DeleteLastLine1-Output.txt"));

                AssertFile.IsEmpty(result);
            }
            public void WhenFileIsNotEmpty_ThenAssertFalse()
            {
                var file = BaseDir.CreateFile("SizeEquals-Test1.txt", "A");

                Assert.Throws <AssertionException>(() => AssertFile.IsEmpty(file));
            }
            public void WhenFileIsEmpty_ThenAssertTrue()
            {
                var file = BaseDir.CreateFile("SizeEquals-Test1.txt", string.Empty);

                Assert.DoesNotThrow(() => AssertFile.IsEmpty(file));
            }
Example #6
0
 public void WhenFileIsNull_ThenThrowException()
 {
     Assert.Throws <ArgumentNullException>(() => AssertFile.IsEmpty(null as FileInfo));
 }