コード例 #1
0
        public void Success_Messages_Not_Null_By_Default()
        {
            IOutcome outcome = Outcomes.Success();

            Assert.IsTrue(outcome.Success);
            Assert.IsNotNull(outcome.Messages);
            Assert.IsTrue(outcome.ToString() == string.Empty);
        }
コード例 #2
0
        public void Success_WithMessage_Supports_Format()
        {
            IOutcome outcome = Outcomes.Success()
                               .WithMessage("Bob {0} at {1}", "wins", "life");

            Assert.True(outcome.Success);
            Assert.True(outcome.ToString() == "Bob wins at life");
        }
コード例 #3
0
        public void Success_Messages_OfT_Not_Null_By_Default()
        {
            IOutcome <int> outcome = Outcomes.Success <int>();

            Assert.IsTrue(outcome.Success);
            Assert.IsNotNull(outcome.Messages);
            Assert.IsTrue(outcome.Value == 0);
            Assert.IsTrue(outcome.ToString() == string.Empty);
        }
コード例 #4
0
        public void Failure_OfT_Messages_Not_Null_By_Default()
        {
            IOutcome <int> outcome = Outcomes.Failure <int>();

            Assert.False(outcome.Success);
            Assert.NotNull(outcome.Messages);
            Assert.True(outcome.Value == 0);
            Assert.True(outcome.ToString() == string.Empty);
        }
コード例 #5
0
        public void Failure_Messages_Not_Null_By_Default()
        {
            IOutcome outcome = Outcomes.Failure();

            Assert.False(outcome.Success);
            Assert.NotNull(outcome.Messages);
            Assert.True(outcome.ToString() == string.Empty);

            //This should also work.
            IOutcome <object> o = (IOutcome <object>)outcome;

            Assert.Null(o.Value);
        }