Пример #1
0
        public void TestApplicationIs64BitCommand(string packageFileName, PackageEvent packageEvent, bool expectedResult)
        {
            var commandResult = CommandTestWrapper.Execute
                                (
                (action, command, loggerFactory) => new ApplicationIs64BitCommand(action, command, loggerFactory),
                LoggerFactory,
                Path.Combine(RootFolder, "local.choco", packageFileName),
                new Library.Settings.Command(),
                packageEvent
                                );

            Assert.Equal(expectedResult, commandResult.ResultValid);
        }
        public void Invalid_Config_Test()
        {
            var commandResult = CommandTestWrapper.Execute
                                (
                (action, command, loggerFactory) => new ConfigReviewCommand(action, command, loggerFactory),
                LoggerFactory,
                Path.Combine(RootFolder, "local.choco", "InvalidConfig.Package.1.0.0.nupkg"),
                new Library.Settings.Command(),
                PackageEvent.Added
                                );

            Assert.False(commandResult.ResultValid);
        }
        public void No_Matching_Pair_Test(string packageFileName)
        {
            var commandResult = CommandTestWrapper.Execute
                                (
                (action, command, loggerFactory) => new ConfigReviewCommand(action, command, loggerFactory),
                LoggerFactory,
                Path.Combine(RootFolder, "local.choco", packageFileName),
                new Library.Settings.Command(),
                PackageEvent.Added
                                );

            Assert.True(commandResult.ResultValid);
        }
        public void General_Test(string key, string value, PackageEvent packageEvent, bool expectedResult)
        {
            var commandResult = CommandTestWrapper.Execute
                                (
                (action, command, loggerFactory) => new Log4netReviewCommand(action, command, loggerFactory),
                LoggerFactory,
                Path.Combine(RootFolder, "local.choco", "Test.Package.1.0.0.nupkg"),
                new Library.Settings.Command()
            {
                Settings =
                {
                    { key, value },
                }
            },
                packageEvent
                                );

            Assert.Equal(expectedResult, commandResult.ResultValid);
        }
        public void ConversionPattern_Test(string conversionPattern, bool expectedResult)
        {
            var commandResult = CommandTestWrapper.Execute
                                (
                (action, command, loggerFactory) => new Log4netReviewCommand(action, command, loggerFactory),
                LoggerFactory,
                Path.Combine(RootFolder, "local.choco", "Test.Package.1.0.0.nupkg"),
                new Library.Settings.Command()
            {
                Settings =
                {
                    { "ConversionPattern", conversionPattern },
                }
            },
                PackageEvent.Added
                                );

            Assert.Equal(expectedResult, commandResult.ResultValid);
        }
Пример #6
0
        public void PackageId_Regex_Test(string packageIdRegex, bool expectedResult)
        {
            var commandResult = CommandTestWrapper.Execute
                                (
                (action, command, loggerFactory) => new NugetContainsSupportFilesCommand(action, command, loggerFactory),
                LoggerFactory,
                Path.Combine(RootFolder, "local.choco", "Has.Some.Support.Files.1.0.0.nupkg"),
                new Library.Settings.Command()
            {
                Settings =
                {
                    { "PackageIdRegex", packageIdRegex }
                }
            },
                PackageEvent.Added
                                );

            Assert.Equal(expectedResult, commandResult.ResultValid);
        }
        [InlineData("Files.With.Package.Name.4.1.0.nupkg", @"^~PackageId~.*\.(dll|exe)", true)]      // Use the packageId replacement token.
        public void File_Regex_Test(string fileName, string fileRegex, bool expectedResult)
        {
            var commandResult = CommandTestWrapper.Execute
                                (
                (action, command, loggerFactory) => new VersioningCheckCommand(action, command, loggerFactory),
                LoggerFactory,
                Path.Combine(RootFolder, "local.choco", fileName),
                new Library.Settings.Command()
            {
                Settings =
                {
                    { "FileRegex", fileRegex }
                }
            },
                PackageEvent.Added
                                );

            Assert.Equal(expectedResult, commandResult.ResultValid);
        }
        public void PackageId_Regex_Test(string packageIdRegex, bool expectedResult)
        {
            var commandResult = CommandTestWrapper.Execute
                                (
                (action, command, loggerFactory) => new VersioningCheckCommand(action, command, loggerFactory),
                LoggerFactory,
                Path.Combine(RootFolder, "local.choco", "Different.Version.From.Package.1.0.0.nupkg"),
                new Library.Settings.Command()
            {
                Settings =
                {
                    { "PackageIdRegex", packageIdRegex }
                }
            },
                PackageEvent.Added
                                );

            Assert.Equal(expectedResult, commandResult.ResultValid);
        }
        public void PackageId_Regex_Test(string packageIdRegex, bool expectedResult)
        {
            var commandResult = CommandTestWrapper.Execute
                                (
                (action, command, loggerFactory) => new Log4netReviewCommand(action, command, loggerFactory),
                LoggerFactory,
                Path.Combine(RootFolder, "local.choco", "Test.Package.1.0.0.nupkg"),
                new Library.Settings.Command()
            {
                Settings =
                {
                    { "PackageIdRegex",              packageIdRegex },
                    { "/configuration/log4net/root", "OFF"          },
                }
            },
                PackageEvent.Added
                                );

            Assert.Equal(expectedResult, commandResult.ResultValid);
        }
Пример #10
0
        [InlineData("Files.With.Package.Name.4.1.0.nupkg", @"^~PackageId~.*", true, true, true)] // Use the packageId replacement token.
        public void File_Regex_Test(string packageFileName, string fileRegex, bool checkForXml, bool checkForPdb, bool expectedResult)
        {
            var commandResult = CommandTestWrapper.Execute
                                (
                (action, command, loggerFactory) => new NugetContainsSupportFilesCommand(action, command, loggerFactory),
                LoggerFactory,
                Path.Combine(RootFolder, "local.choco", packageFileName),
                new Library.Settings.Command()
            {
                Settings =
                {
                    { "FileRegex",   fileRegex              },
                    { "CheckForXml", checkForXml.ToString() },
                    { "CheckForPdb", checkForPdb.ToString() }
                }
            },
                PackageEvent.Added
                                );

            Assert.Equal(expectedResult, commandResult.ResultValid);
        }