public async void Get_Test()
        {
            IDirectory iDirectory = Substitute.For <IDirectory>();

            iDirectory.GetFilesAsync("*.*", SearchOption.AllDirectories).Returns(new List <string>
            {
                @"f\bla\ra\t.dat",
                @"books\csharp\csharp.pdf",
                @"proj\tools\utils.cpp"
            });

            int    expected1 = 3;
            string expected2 = @"tad.t\ar\alb\f";
            string expected3 = @"fdp.prahsc\prahsc\skoob";
            string expected4 = @"ppc.slitu\sloot\jorp";

            IFileFilter filter = new FilterManager("reversed2");

            string[] actual = await filter.GetFilteredFiles(iDirectory);

            Assert.Equal(expected1, actual.Length);
            Assert.Equal(expected2, actual[0]);
            Assert.Equal(expected3, actual[1]);
            Assert.Equal(expected4, actual[2]);
        }
        public async void Get_Test()
        {
            IDirectory iDirectory = Substitute.For <IDirectory>();

            iDirectory.GetFilesAsync("*.cpp", SearchOption.AllDirectories).Returns(new List <string>
            {
                @"f\bla\ra\t.dat",
                @"books\csharp\csharp.pdf",
                @"proj\tools\utils.cpp"
            });

            int    expected1 = 1;
            string expected2 = @"proj\tools\utils.cpp";

            IFileFilter filter = new FilterManager("cpp");

            string[] actual = await filter.GetFilteredFiles(iDirectory);

            Assert.Equal(expected1, actual.Length);
            Assert.Equal(expected2, actual[0]);
        }
Exemple #3
0
        public async void Get_Test()
        {
            IDirectory iDirectory = Substitute.For <IDirectory>();

            iDirectory.GetFilesAsync("*.*", SearchOption.AllDirectories).Returns(new List <string>
            {
                @"f\bla\ra\t.dat",
                @"books\csharp\csharp.pdf"
            });

            int    expected1 = 2;
            string expected2 = @"t.dat\ra\bla\f";
            string expected3 = @"csharp.pdf\csharp\books";

            IFileFilter filter = new FilterManager("reversed1");

            string[] actual = await filter.GetFilteredFiles(iDirectory);

            Assert.Equal(expected1, actual.Length);
            Assert.Equal(expected2, actual[0]);
            Assert.Equal(expected3, actual[1]);
        }