Esempio n. 1
0
        public void ActionPossible_WhenReturned_StaticErrorListBecomesEmpty_DefaultMessageInErrorList()
        {
            ActionPossible.AddError("Error message 1");
            ActionPossible.AddError("Error message 2");
            ActionPossible.AddError("Error message 3");

            var result = ActionPossible.FalseWithErrors();

            Assert.That(result.Errors.Count(), Is.EqualTo(3));

            var nextResult = ActionPossible.FalseWithErrors();

            Assert.Multiple(() =>
            {
                Assert.That(nextResult.Errors.Count(), Is.EqualTo(1));
                Assert.That(nextResult.Errors, Contains.Item("You are not allowed to perform this action"));
            });
        }
Esempio n. 2
0
        public void ActionPossible_WhenFalseWithManyError_ReturnsCorrectInfo()
        {
            ActionPossible.AddError("Error message 1");
            ActionPossible.AddError("Error message 2");
            ActionPossible.AddError("Error message 3");

            var result = ActionPossible.FalseWithErrors();

            Assert.Multiple(() =>
            {
                Assert.That(result.IsPossible, Is.False);
                Assert.That(result.IsImpossible, Is.True);
                Assert.That(result.Errors.Count(), Is.EqualTo(3));
                Assert.That(result.Errors, Contains.Item("Error message 1"));
                Assert.That(result.Errors, Contains.Item("Error message 2"));
                Assert.That(result.Errors, Contains.Item("Error message 3"));
            });
        }