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")); }
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")); }
public void WeaklyTypedIfNotCastableSuccess() { Fail.IfNotCastable(new List <string>(), typeof(IList <string>), Violation.Of("wrong type")); }
public void WeaklyTypedIfNotCastableWithNull() { Fail.IfNotCastable(null, typeof(IList <string>), Violation.Of("wrong type")); }
public void IfNotCastableSuccess() { Fail.IfNotCastable <IList <string> >(new List <string>(), Violation.Of("wrong type")); }
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"); }