Ejemplo n.º 1
0
 public void One_more()
 {
     Assert.That(() => { throw new InvalidOperationException(); }, Throws.An <NotSupportedException>());
 }
Ejemplo n.º 2
0
        public void CalculateFinalPriceShouldThrowNullReferenceExceptionIfProvidedProductIsNull()
        {
            void CallingCalculateFinalPriceWithPassedNullProductModel() => Algorithm.CalculateFinalPrice(null, _state, 1);

            Assert.That(CallingCalculateFinalPriceWithPassedNullProductModel, Throws.An <NullReferenceException>());
        }
Ejemplo n.º 3
0
 public void One_more()
 {
     Assert.That(() => { throw new InvalidOperationException(); }, Throws.An <AccessViolationException>());
 }
Ejemplo n.º 4
0
 public void Throw_if_name_is_too_long()
 {
     Assert.That(() => new BinaryAttachment("aVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString", MimeTypes.Png, new byte[0]),
                 Throws.An <ArgumentException>()
                 .With(e => e.Message == "name must be 100 chars or less\r\nParameter name: name" && e.ParamName == "name"));
 }
Ejemplo n.º 5
0
 public void Match_if_action_throws_superclass_of_expected_exception()
 {
     NHAssert.That(() => DoIt(), Throws.An <ArgumentException>());
 }
Ejemplo n.º 6
0
 public void Match_if_thrown_exception_matches_predicate()
 {
     NHAssert.That(DoIt, Throws.An <ArgumentNullException>().With(e => e.Message == "message" &&
                                                                  e.InnerException.GetType() == typeof(Exception)));
 }
Ejemplo n.º 7
0
 public void ToString_WhenTokenIsInvalid_ThrowsException(int token)
 {
     Assert.That(() => Token.ToString(token), Throws.An <ArgumentException>());
 }
Ejemplo n.º 8
0
 public void Match_if_action_throws_expected_exception()
 {
     NHAssert.That(() => DoIt(), Throws.An <ArgumentNullException>());
 }
Ejemplo n.º 9
0
 public void Constructor_WhenErrorLoggerIsNull_ThrowsException()
 {
     Assert.That(
         () => new Parser(Helpers.CreateTextScanner(string.Empty), null), Throws.An <ArgumentNullException>());
 }
Ejemplo n.º 10
0
 public void Constructor_WhenScannerIsNull_ThrowsException()
 {
     Assert.That(() => new Parser(null, null), Throws.An <ArgumentNullException>());
 }
Ejemplo n.º 11
0
 public void Constructor_WhenErrorLoggerIsNull_ThrowsException()
 {
     Assert.That(() => new Scanner(string.Empty, null), Throws.An <ArgumentNullException>());
 }
Ejemplo n.º 12
0
 public void Parse_WhenFormatIsNull_ThrowsException()
 {
     Assert.That(() => Format.Parse(null), Throws.An <ArgumentNullException>());
 }
Ejemplo n.º 13
0
 public void Evaluate_WhenFormatIsNull_ThrowsException()
 {
     Assert.That(() => Format.Evaluate((string)null), Throws.An <ArgumentNullException>());
 }
Ejemplo n.º 14
0
 public void Constructor_WhenTextIsNull_ThrowsException()
 {
     Assert.That(() => new TokenInfo(Location.Unknown, Token.Invalid, null), Throws.An <ArgumentNullException>());
 }
Ejemplo n.º 15
0
 public void Constructor_WhenLocationIsNull_ThrowsException()
 {
     Assert.That(() => new TokenInfo(null, Token.Invalid, string.Empty), Throws.An <ArgumentNullException>());
 }