public void RegisterDefaultExceptionEditorで登録したエディタはRegisterExceptionEditorで上書きできる() { // when FixtureBook.RegisterDefaultExceptionEditor <ApplicationException>(e => { Console.WriteLine(e); Assert.AreEqual("app", e.Message); return(new Dictionary <string, string>() { { "Message", "ZZZ" } }); }); FixtureBook fixtureBook = new FixtureBook(); fixtureBook.RegisterExceptionEditor <ApplicationException>(e => { Console.WriteLine(e); Assert.AreEqual("app", e.Message); return(new Dictionary <string, string>() { { "Message", "zzz" } }); }); // then fixtureBook.Validate <ApplicationException>(() => { throw new ApplicationException("app"); }, "Exception"); }
public void RegisterDefaultExceptionEditorで登録したエディタで例外を編集できる() { // when FixtureBook.RegisterDefaultExceptionEditor((SystemException e) => { Console.WriteLine(e); Assert.AreEqual("sys", e.Message); return(new Dictionary <string, string>() { { "Message", "zzz" } }); }); // then FixtureBook.ExpectThrown <SystemException>(() => { throw new SystemException("sys"); }); FixtureBook.ExpectThrown <SystemException>(typeof(SystemExceptionThrower), "ThrowSystemException"); }