public void IfEmptyWithMessageSuccess()
        {
            // ARRANGE
            Guid notEmptyGuid = Guid.NewGuid();

            // ACT
            Fail.IfEmpty(notEmptyGuid, Violation.Of("guid is empty and it shouldn't be"));
        }
Exemple #2
0
        public void IfEmptySuccess()
        {
            // ARRANGE
            Guid notEmptyGuid = Guid.NewGuid();

            // ACT
            Fail.IfEmpty(notEmptyGuid, "guid is empty and it shouldn't be");
        }
        public void IfEmptyWithMessage()
        {
            // ACT
            var exception = Assert.Throws <DesignByContractViolationException>(
                () => Fail.IfEmpty(Guid.Empty, Violation.Of("guid is empty and it shouldn't be"))
                );

            // ASSERT
            Assert.That(exception.Message, Is.EqualTo("guid is empty and it shouldn't be"));
        }
        public void IfEmpty()
        {
            Assert.Throws <DesignByContractViolationException>(
                () => Fail.IfEmpty("", "message")
                );

            Assert.Throws <DesignByContractViolationException>(
                () => Fail.IfEmpty(null, "message")
                );

            Fail.IfEmpty("   ", "message");
            Fail.IfEmpty("aa", "message");
        }
        public void IfDateEmpty()
        {
            // ARRANGE
            DateTime minDate = DateTime.MinValue;

            // ACT
            var exception = Assert.Throws <DesignByContractViolationException>(
                () => Fail.IfEmpty(minDate, nameof(minDate))
                );

            // ASSERT
            Assert.That(exception.Message, Is.EqualTo("'minDate' is empty = 01/01/0001 00:00:00"));
        }
 public void IfEmptyWithMessageSuccess([NotNull] string text)
 {
     Fail.IfEmpty(text, Violation.Of("it shouldn't be empty"));
 }
 public void IfEmptyWithMessage(string text)
 {
     Assert.Throws <DesignByContractViolationException>(
         () => Fail.IfEmpty(text, Violation.Of("it shouldn't be empty"))
         );
 }
 public void IfEmptyWithNameSuccess([NotNull] string text)
 {
     Fail.IfEmpty(text, nameof(text));
 }
 public void IfEmptyWithName(string text)
 {
     Assert.Throws <DesignByContractViolationException>(
         () => Fail.IfEmpty(text, nameof(text))
         );
 }
 public void IfDateEmptySuccess()
 {
     // ACT
     Fail.IfEmpty(DateTime.Today, nameof(DateTime.Today));
 }