public void RegisterExceptionEditorで登録したエディタで例外を編集できる() { // setup FixtureBook fixtureBook = new FixtureBook(); // when fixtureBook.RegisterExceptionEditor((SystemException e) => { Console.WriteLine(e); Assert.AreEqual("sys", e.Message); return(new Dictionary <string, string>() { { "Message", "zzz" } }); }); fixtureBook.RegisterExceptionEditor <ApplicationException>(e => { Console.WriteLine(e); Assert.AreEqual("app", e.Message); return(new Dictionary <string, string>() { { "Message", "zzz" } }); }); // then fixtureBook.Validate <SystemException>(() => { throw new SystemException("sys"); }, "Exception"); fixtureBook.Validate <ApplicationException>(() => { throw new ApplicationException("app"); }, "Exception"); }
public void Validateは指定されたオブジェクトが予想結果と等しいかどうかを調べる() { // setup Dictionary <string, object> actual = fixtureBook.GetObject <Dictionary <string, object> >("Data"); // expect fixtureBook.Validate(actual, "Data"); }
public void Validateは指定されたオブジェクトが予想結果と等しいかどうかを調べる() { // setup DataTable actual = fixtureBook.GetObject <DataTable>("Data"); // expect fixtureBook.Validate(actual, "Data"); }
public void 指定されたデータをデータベーステーブルに投入できる_SQLServer() { // setup Loggi.DebugEnabled = true; // when fixtureBook.Setup(); // then DataTable table = Database.ExecuteQuery(null, "select * from TypesTable order by Id"); fixtureBook.Validate(table, "TypesTable"); }
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 ValidateメソッドはSetupメソッドの暗黙呼び出しを行わないこと() { // setup Loggi.DebugEnabled = true; using (Database database = new Database()) { database.ExecuteNonQuery("delete from TypesTable"); database.Commit(); } FixtureBook fixtureBook = new FixtureBook(); // when Dictionary <string, string> obj = new Dictionary <string, string>(); obj["Id"] = "1"; fixtureBook.Validate(obj); // then using (Database database = new Database()) { Assert.AreEqual(0, database.ExecuteQuery("select * from TypesTable").Rows.Count); } // when fixtureBook.Setup(); // then using (Database database = new Database()) { Assert.AreEqual(1, database.ExecuteQuery("select * from TypesTable").Rows.Count); } }
public void 要素数ゼロのListを検証できる_正常() { // setup List <Data> list = fixtureBook.GetList <Data>(); // expect Assert.AreEqual(0, list.Count); fixtureBook.Validate(list); }
public void Validateは指定されたリストが予想結果と等しいかどうかを調べる() { // setup List <Data> actual = fixtureBook.GetList <Data>(); // expect fixtureBook.Validate(actual); }
public void ValidateメソッドはSetupメソッドの暗黙呼び出しを行わないこと() { // setup Loggi.DebugEnabled = true; using (Database database = new Database()) { database.ExecuteNonQuery("delete from TypesTable"); database.Commit(); } FixtureBook fixtureBook = new FixtureBook(); // when Dictionary<string, string> obj = new Dictionary<string, string>(); obj["Id"] = "1"; fixtureBook.Validate(obj); // then using (Database database = new Database()) { Assert.AreEqual(0, database.ExecuteQuery("select * from TypesTable").Rows.Count); } // when fixtureBook.Setup(); // then using (Database database = new Database()) { Assert.AreEqual(1, database.ExecuteQuery("select * from TypesTable").Rows.Count); } }