Ejemplo n.º 1
0
        public void WeaklyTypedIfNotCastable()
        {
            // ACT
            var exception = Assert.Throws <DesignByContractViolationException>(
                () => Fail.IfNotCastable(new object(), typeof(IQueryable), Violation.Of("wrong type"))
                );

            // ASSERT
            Assert.That(exception.Message, Is.EqualTo("wrong type"));
        }
Ejemplo n.º 2
0
        public void IfNotCastable()
        {
            // ARRANGE
            var somethingNotCastable = new object();

            // ACT
            var exception = Assert.Throws <DesignByContractViolationException>(
                () => Fail.IfNotCastable <IQueryable>(somethingNotCastable, Violation.Of("wrong type"))
                );

            // ASSERT
            Assert.That(exception.Message, Is.EqualTo("wrong type"));
        }
Ejemplo n.º 3
0
 public void WeaklyTypedIfNotCastableSuccess()
 {
     Fail.IfNotCastable(new List <string>(), typeof(IList <string>), Violation.Of("wrong type"));
 }
Ejemplo n.º 4
0
 public void WeaklyTypedIfNotCastableWithNull()
 {
     Fail.IfNotCastable(null, typeof(IList <string>), Violation.Of("wrong type"));
 }
Ejemplo n.º 5
0
 public void IfNotCastableSuccess()
 {
     Fail.IfNotCastable <IList <string> >(new List <string>(), Violation.Of("wrong type"));
 }
Ejemplo n.º 6
0
 public void IfNotCastableWithNull()
 {
     Fail.IfNotCastable <IList <string> >(null, Violation.Of("wrong type"));
 }
 public void IfNotCastableSuccess()
 {
     Fail.IfNotCastable <IList <string> >(new List <string>(), "wrong type");
 }
 public void IfNotCastableWithNull()
 {
     Fail.IfNotCastable <IList <string> >(null, "wrong type");
 }