-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Assert() の exception パラメーター省略時の `TestActual.Exception` 再スローでスタックトレースが失われていたので修正。 * readme.md を更新。
- Loading branch information
Showing
7 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
|
||
#if !NETSTANDARD1_0 | ||
|
||
using System.Runtime.Serialization; | ||
|
||
#endif | ||
|
||
namespace Inasync { | ||
/// <summary> | ||
/// Assert 時に検証されなかった <see cref="TestActual.Exception"/> を内包する例外を表します。 | ||
/// </summary> | ||
#if !NETSTANDARD1_0 | ||
|
||
[Serializable] | ||
#endif | ||
public class TestAssertException : Exception { | ||
private const string _defaultMessage = "TestActual に例外が含まれていますが、検証されませんでした。"; | ||
|
||
/// <summary> | ||
/// 指定したエラー メッセージおよびこの例外の原因となった内部例外への参照を使用して、<see cref="TestAssertException"/> クラスの新しいインスタンスを初期化します。 | ||
/// </summary> | ||
/// <param name="message">例外の原因を説明するエラー メッセージ。</param> | ||
/// <param name="innerException">現在の例外の原因である例外。内部例外が指定されていない場合は <c>null</c> 参照。</param> | ||
public TestAssertException(string message, Exception innerException) : base(message ?? _defaultMessage, innerException) { | ||
} | ||
|
||
#if !NETSTANDARD1_0 | ||
|
||
/// <summary> | ||
/// シリアル化したデータを使用して、<see cref="TestAssertException"/> クラスの新しいインスタンスを初期化します。 | ||
/// </summary> | ||
/// <param name="info">スローされている例外に関するシリアル化済みオブジェクト データを保持している <see cref="SerializationInfo"/>。</param> | ||
/// <param name="context">転送元または転送先についてのコンテキスト情報を含む <see cref="StreamingContext"/>。</param> | ||
protected TestAssertException(SerializationInfo info, StreamingContext context) : base(info, context) { | ||
} | ||
|
||
#endif | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Inasync.Tests { | ||
|
||
[TestClass] | ||
public class TestAssertException_Tests { | ||
|
||
[TestMethod] | ||
public void Ctor() { | ||
var message = "abc"; | ||
var innerException = new Exception(); | ||
|
||
// Act | ||
var @return = new TestAssertException(message, innerException); | ||
|
||
// Assert | ||
Assert.AreEqual(message, @return.Message); | ||
Assert.AreSame(innerException, @return.InnerException); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters