-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExceptionUnitTest.cs
39 lines (33 loc) · 1.28 KB
/
ExceptionUnitTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//-----------------------------------------------------------------------
// <copyright file="$rootname$" company="$company$">
// Copyright (c) $company$. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace $rootnamespace$
{
public class $safeitemname$
{
[Fact]
public void Constructor()
{
var exception = new $classnameundertest$();
exception.Message.Should().Be("Exception of type '$namespaceundertest$.$classnameundertest$' was thrown.");
exception.InnerException.Should().BeNull();
}
[Fact]
public void Constructor_WithMessage()
{
var exception = new $classnameundertest$("The message");
exception.Message.Should().Be("The message");
exception.InnerException.Should().BeNull();
}
[Fact]
public void Constructor_WithMessageAndInnerException()
{
var innerException = new FormatException("The inner exception");
var exception = new $classnameundertest$("The message", innerException);
exception.Message.Should().Be("The message");
exception.InnerException.Should().BeSameAs(innerException);
}
}
}