public void DirectoryExists()
 {
     var stub = new DirServiceSmartStub(@"
     A\B\1
     ");
     Assert.IsTrue(stub.DirectoryExists("A"));
     Assert.IsTrue(stub.DirectoryExists(@"A\B"));
     Assert.IsTrue(stub.DirectoryExists(@"a\b"), "Must be case insensitive");
     Assert.IsFalse(stub.DirectoryExists(@"A\B\1"));
     Assert.IsFalse(stub.DirectoryExists(@"B"));
 }
        public void GetDirectories()
        {
            var stub = new DirServiceSmartStub(@"
            A\B\1
            a\a\z\
            ");
            TAssert.ArraysEqual(stub.GetDirectories(@"a"), new[] { @"A\B", @"a\a" });
            TAssert.ArraysEqual(stub.GetDirectories(@"A\B"), new string[0]);
            TAssert.ArraysEqual(stub.GetDirectories(@"a\a"), new[] { @"a\a\z" });
            TAssert.ArraysEqual(stub.GetDirectories(@"a\a\z"), new string[0]);

            TAssert.ArraysEqual(stub.GetDirectories(@"foo"), new string[0]);
            TAssert.ArraysEqual(stub.GetDirectories(@"B"), new string[0]);
        }
 public void GetFiles()
 {
     var stub = new DirServiceSmartStub(@"
     A\B\1
     A\B\2
     a\a\z\
     ");
     TAssert.ArraysEqual(stub.GetFiles(@"a"), new string[0]);
     TAssert.ArraysEqual(stub.GetFiles(@"a\b"), new[] { "1", "2" });
     TAssert.ArraysEqual(stub.GetFiles(@"a\a\z"), new string[0]);
 }
 public void InDirWith2SameFilesButDifferentCase_1Result()
 {
     // Arrange
     var dirService = new DirServiceSmartStub(@"
     A\x.txt
     A\y.txt
     A\B\X.txt
     ");
     var filesFinder = new FilesFinder(dirService);
     // Act
     var result = filesFinder.SearchWithSameNames("A");
     // Assert
     Assert.AreEqual(1, result.Count);
     Assert.AreEqual("x.txt", result[0].FileName);
     Assert.AreEqual(2, result[0].Count);
 }
        public void InDirWith2Plus2SameFiles_2Results()
        {
            // Arrange
            var dirService = new DirServiceSmartStub(@"
            a\1.txt
            a\2.txt
            a\b\1.txt
            a\b\2.txt
            a\b\c\2.txt
            ");
            var filesFinder = new FilesFinder(dirService);
            // Act
            var result = filesFinder.SearchWithSameNames("a");
            // Assert
            Assert.AreEqual(2, result.Count);
            Assert.AreEqual("1.txt", result[0].FileName);
            Assert.AreEqual(2, result[0].Count);

            Assert.AreEqual("2.txt", result[1].FileName);
            Assert.AreEqual(3, result[1].Count);
        }