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

            var packages = new List <PackageUpdateSet>();

            var solutionRestore = new SolutionRestore(cmd);

            await solutionRestore.CheckRestore(packages, folder, NuGetSources.GlobalFeed);

            await cmd.DidNotReceiveWithAnyArgs()
            .Invoke(Arg.Any <FileInfo>(), Arg.Any <NuGetSources>());
        }
Esempio n. 2
0
        public async Task WhenThereAreNoMatchingPackagesTheCommandIsNotCalled()
        {
            var packages = PackageUpdates.ForPackageRefType(PackageReferenceType.ProjectFile)
                           .InList();

            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 solutionRestore = new SolutionRestore(cmd);

            await solutionRestore.CheckRestore(packages, folder, NuGetSources.GlobalFeed);

            await cmd.DidNotReceiveWithAnyArgs()
            .Invoke(Arg.Any <FileInfo>(), Arg.Any <NuGetSources>());
        }
Esempio n. 3
0
        public async Task WhenThereIsOneSolutionsTheCommandIsCalled()
        {
            var packages = PackageUpdates.ForPackageRefType(PackageReferenceType.PackagesConfig)
                           .InList();

            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 solutionRestore = new SolutionRestore(cmd);

            await solutionRestore.CheckRestore(packages, folder, NuGetSources.GlobalFeed);

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

            await cmd.Received().Invoke(sln, Arg.Any <NuGetSources>());
        }