コード例 #1
0
        public void Full()
        {
            string configTmpFile = Path.GetTempFileName();

            try
            {
                File.WriteAllText(configTmpFile, BotConfigsForTesting.Full());
                MultilinerBotConfiguration config =
                    MultilinerBotConfiguration.BuidFromConfigFile(configTmpFile);

                Assert.That(config.Server, Is.EqualTo("localhost:8084"));
                Assert.That(config.Repository, Is.EqualTo("assets"));
                Assert.That(config.BranchPrefix, Is.EqualTo("AST-"));
                Assert.That(config.MergeToBranchesAttrName, Is.EqualTo("target"));
                Assert.That(config.UserApiKey, Is.EqualTo("BAEE806DB01"));

                Assert.That(config.Plastic, Is.Not.Null);
                Assert.That(config.Plastic.IsApprovedCodeReviewFilterEnabled, Is.False);
                Assert.That(config.Plastic.IsBranchAttrFilterEnabled, Is.True);

                Assert.That(config.Plastic.StatusAttribute, Is.Not.Null);
                Assert.That(config.Plastic.StatusAttribute.Name, Is.EqualTo("status"));
                Assert.That(config.Plastic.StatusAttribute.ResolvedValue, Is.EqualTo("resolved"));
                Assert.That(config.Plastic.StatusAttribute.TestingValue, Is.EqualTo("testing"));
                Assert.That(config.Plastic.StatusAttribute.FailedValue, Is.EqualTo("failed"));
                Assert.That(config.Plastic.StatusAttribute.MergedValue, Is.EqualTo("merged"));

                Assert.That(config.Issues, Is.Not.Null);
                Assert.That(config.Issues.Plug, Is.EqualTo("tts"));
                Assert.That(config.Issues.ProjectKey, Is.EqualTo("AST"));
                Assert.That(config.Issues.TitleField, Is.EqualTo("title"));

                Assert.That(config.Issues.StatusField, Is.Not.Null);
                Assert.That(config.Issues.StatusField.Name, Is.EqualTo("status"));
                Assert.That(config.Issues.StatusField.ResolvedValue, Is.EqualTo("validated"));
                Assert.That(config.Issues.StatusField.TestingValue, Is.EqualTo("testing"));
                Assert.That(config.Issues.StatusField.FailedValue, Is.EqualTo("open"));
                Assert.That(config.Issues.StatusField.MergedValue, Is.EqualTo("closed"));

                Assert.That(config.CI, Is.Not.Null);
                Assert.That(config.CI.Plug, Is.EqualTo("My Jenkins"));
                Assert.That(config.CI.PlanBranch, Is.EqualTo("debug plan"));
                Assert.That(config.CI.PlanAfterCheckin, Is.EqualTo("release plan"));

                Assert.That(config.Notifiers, Is.Not.Null.And.Count.EqualTo(1));
                Assert.That(config.Notifiers[0].Name, Is.EqualTo("notifier1"));
                Assert.That(config.Notifiers[0].Plug, Is.EqualTo("email"));
                Assert.That(config.Notifiers[0].UserProfileField, Is.EqualTo("email"));
                Assert.That(
                    config.Notifiers[0].FixedRecipients,
                    Is.Not.Null.And.Length.EqualTo(2).And.Contains("me").And.Contains("you"));
            }
            finally
            {
                if (File.Exists(configTmpFile))
                {
                    File.Delete(configTmpFile);
                }
            }
        }
コード例 #2
0
        public void OnlyCIPlug()
        {
            string configTmpFile = Path.GetTempFileName();

            try
            {
                File.WriteAllText(configTmpFile, BotConfigsForTesting.OnlyCIPlug());
                MultilinerBotConfiguration config =
                    MultilinerBotConfiguration.BuidFromConfigFile(configTmpFile);

                Assert.That(config.Server, Is.EqualTo("localhost:8084"));
                Assert.That(config.Repository, Is.EqualTo("assets"));
                Assert.That(config.BranchPrefix, Is.EqualTo("AST-"));
                Assert.That(config.MergeToBranchesAttrName, Is.EqualTo("target"));
                Assert.That(config.UserApiKey, Is.EqualTo("BAEE806DB01"));

                Assert.That(config.Plastic, Is.Not.Null);
                Assert.That(config.Plastic.IsApprovedCodeReviewFilterEnabled, Is.False);
                Assert.That(config.Plastic.IsBranchAttrFilterEnabled, Is.True);

                Assert.That(config.Plastic.StatusAttribute, Is.Not.Null);
                Assert.That(config.Plastic.StatusAttribute.Name, Is.EqualTo("status"));
                Assert.That(config.Plastic.StatusAttribute.ResolvedValue, Is.EqualTo("resolved"));
                Assert.That(config.Plastic.StatusAttribute.TestingValue, Is.EqualTo("testing"));
                Assert.That(config.Plastic.StatusAttribute.FailedValue, Is.EqualTo("failed"));
                Assert.That(config.Plastic.StatusAttribute.MergedValue, Is.EqualTo("merged"));

                Assert.That(config.Issues, Is.Null);

                Assert.That(config.CI, Is.Not.Null);
                Assert.That(config.CI.Plug, Is.EqualTo("My Jenkins"));
                Assert.That(config.CI.PlanBranch, Is.EqualTo("debug plan"));
                Assert.That(config.CI.PlanAfterCheckin, Is.EqualTo("release plan"));

                Assert.That(config.Notifiers, Is.Not.Null.And.Empty);
            }
            finally
            {
                if (File.Exists(configTmpFile))
                {
                    File.Delete(configTmpFile);
                }
            }
        }