public void TestNewDecisionReasonWithoutIncludeReasons()
        {
            var decisionReasons = new DecisionReasons();

            decisionReasons.AddError(DecisionMessage.Reason(DecisionMessage.FLAG_KEY_INVALID, "invalid_key"));

            Assert.AreEqual(decisionReasons.ToReport()[0], "No flag was found for key \"invalid_key\".");
            decisionReasons.AddError(DecisionMessage.Reason(DecisionMessage.VARIABLE_VALUE_INVALID, "invalid_key"));
            Assert.AreEqual(decisionReasons.ToReport()[1], "Variable value for key \"invalid_key\" is invalid or wrong type.");
            decisionReasons.AddInfo("Some info message.");
            Assert.AreEqual(decisionReasons.ToReport().Count, 2);
        }
        public void TestNewDecisionReasonWithIncludeReasons()
        {
            var decisionReasons = new DecisionReasons();
            var decideOptions   = new OptimizelyDecideOption[] { OptimizelyDecideOption.INCLUDE_REASONS };

            decisionReasons.AddError(DecisionMessage.Reason(DecisionMessage.FLAG_KEY_INVALID, "invalid_key"));

            Assert.AreEqual(decisionReasons.ToReport(decideOptions.Contains(OptimizelyDecideOption.INCLUDE_REASONS))[0], "No flag was found for key \"invalid_key\".");
            decisionReasons.AddError(DecisionMessage.Reason(DecisionMessage.VARIABLE_VALUE_INVALID, "invalid_key"));
            Assert.AreEqual(decisionReasons.ToReport(decideOptions.Contains(OptimizelyDecideOption.INCLUDE_REASONS))[1], "Variable value for key \"invalid_key\" is invalid or wrong type.");
            decisionReasons.AddInfo("Some info message.");
            Assert.AreEqual(decisionReasons.ToReport(decideOptions.Contains(OptimizelyDecideOption.INCLUDE_REASONS))[2], "Some info message.");
        }
Exemple #3
0
 public static void AreEqual(DecisionReasons expected, DecisionReasons actual)
 {
     AreEquivalent(expected.ToReport(), actual.ToReport());
 }