示例#1
0
        public void WhenThereIsAMinorUpdate()
        {
            var logger   = Substitute.For <INuKeeperLogger>();
            var reporter = new PackageLookupResultReporter(logger);

            var fooMetadata = new PackageSearchMedatadata(
                new PackageIdentity("foo", new NuGetVersion(2, 3, 4)),
                new PackageSource("http://none"), DateTimeOffset.Now, null);

            var data = new PackageLookupResult(VersionChange.Minor, fooMetadata, fooMetadata, fooMetadata);

            reporter.Report(data);

            logger.Received()
            .Detailed("Selected update of package foo to highest version, 2.3.4. Allowing Minor version updates.");

            logger.DidNotReceive().Error(Arg.Any <string>());
            logger.DidNotReceive().Minimal(Arg.Any <string>());
            logger.DidNotReceive().Normal(Arg.Any <string>());
        }
        public void WhenThereIsAMajorAndAMinorUpdate()
        {
            var logger   = Substitute.For <INuKeeperLogger>();
            var reporter = new PackageLookupResultReporter(logger);

            var fooMajor = new PackageSearchMedatadata(
                new PackageIdentity("foo", new NuGetVersion(3, 0, 0)),
                new PackageSource("http://none"), DateTimeOffset.Now, null);
            var fooMinor = new PackageSearchMedatadata(
                new PackageIdentity("foo", new NuGetVersion(2, 3, 4)),
                new PackageSource("http://none"), DateTimeOffset.Now, null);

            var data = new PackageLookupResult(VersionChange.Minor, fooMajor, fooMinor, null);

            reporter.Report(data);

            logger.Received()
            .Info("Selected update of package foo to version 2.3.4, but version 3.0.0 is also available. Allowing Minor version updates.");
            logger.DidNotReceive().Error(Arg.Any <string>());
            logger.DidNotReceive().Terse(Arg.Any <string>());
            logger.DidNotReceive().Verbose(Arg.Any <string>());
        }