Exemplo n.º 1
0
        public async Task WhenThereAreNoSolutionsTheCommandIsNotCalled()
        {
            var cmd    = Substitute.For <IFileRestoreCommand>();
            var folder = Substitute.For <IFolder>();

            var solutionResture = new SolutionsRestore(cmd);

            await solutionResture.Restore(folder);

            await cmd.DidNotReceiveWithAnyArgs().Invoke(Arg.Any <FileInfo>());
        }
Exemplo n.º 2
0
        public async Task WhenThereIsOneSolutionsTheCommandIsCalled()
        {
            var sln = new FileInfo("foo.sln");

            var cmd    = Substitute.For <IFileRestoreCommand>();
            var folder = Substitute.For <IFolder>();

            folder.Find(Arg.Any <string>()).Returns(new[] { sln });

            var solutionResture = new SolutionsRestore(cmd);

            await solutionResture.Restore(folder);

            await cmd.Received(1).Invoke(Arg.Any <FileInfo>());

            await cmd.Received().Invoke(sln);
        }
Exemplo n.º 3
0
        public async Task WhenThereAreTwoSolutionsTheCommandIsCalledForEachOfThem()
        {
            var sln1 = new FileInfo("foo.sln");
            var sln2 = new FileInfo("bar.sln");

            var cmd    = Substitute.For <IFileRestoreCommand>();
            var folder = Substitute.For <IFolder>();

            folder.Find(Arg.Any <string>()).Returns(new[] { sln1, sln2 });

            var solutionResture = new SolutionsRestore(cmd);

            await solutionResture.Restore(folder);

            await cmd.Received(2).Invoke(Arg.Any <FileInfo>());

            await cmd.Received().Invoke(sln1);

            await cmd.Received().Invoke(sln2);
        }