public void IsGreaterThanOrEqualToDefaultPass() { var check = new Checkers.Check(); check.That(_unknownPerson.Number).IsGreaterThanOrEqualTo(31337); Assert.IsTrue(check.Failed == false); Assert.IsTrue(check.FailMessages.Count == 0); }
public void TypeTypeTest() { var check = new Checkers.Check(); check.That(_unnamedPerson).IsA(typeof(Person)).Or("You are not a Person; GTFO!").EpicFail("Not a Person"); Assert.IsTrue(check.Failed == false); Assert.IsTrue(check.FailMessages.Count == 0); }
public void IsCanTakeAboutAnything() { var check = new Checkers.Check(); check.That(_unknownPerson).Is(31338); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1); }
public void IsNullDefaultPass() { var check = new Checkers.Check(); check.That(_unknownPerson.Number).IsNull(); Assert.IsTrue(check.Failed == false); Assert.IsTrue(check.FailMessages.Count == 0); }
public void FuncPass() { var check = new Checkers.Check(); check.That(_unknownPerson).Function<Person>(x => x.Number == 31337).Or("fail"); Assert.IsTrue(check.Failed == false); Assert.IsTrue(check.FailMessages.Count == 0); }
public void SingleCheck_Multiple_Ors_LastOrWillHavePresidence_DontDoThis() { var check = new Checkers.Check(); check.That(_unknownPerson.Name).Is(31338).Or("1").Or("2").Or("3"); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1); Assert.IsTrue(check.FailMessages[0] == "3", "Message is: " + check.FailMessages[0]); }
public void IsCanTestIntEquality() { var check = new Checkers.Check(); check.That(_unknownPerson.Number).Is(31338).Or("Wow, thats to much person for me"); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1, "actual: " + check.FailMessages.Count); Assert.IsTrue(check.FailMessages[0] == "Wow, thats to much person for me", "Message is not 'Wow, thats to much person for me'"); }
public void IsWillWorkWithDefaultFail() { var check = new Checkers.Check(); check.That(_unknownPerson.Number).Is(31338); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1, "actual: " + check.FailMessages.Count); Assert.IsTrue(check.FailMessages[0] == _unknownPerson.Number + " is not " + 31338, "Message is not: " + check.FailMessages[0]); }
public void SteveISNotApersonDefault() { var check = new Checkers.Check(); check.That(_unknownPerson.Name).Is("Steve"); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1, "actual: " + check.FailMessages.Count); Assert.IsTrue(check.FailMessages[0] == _unknownPerson.Name + " is not " + "Steve", "Message is " + check.FailMessages[0]); }
public void FuncFail() { var check = new Checkers.Check(); check.That(_unknownPerson).Function<Person>(x => x.Number == 3).Or("fail"); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1); Assert.IsTrue(check.FailMessages[0] == "fail"); }
public void Exception_Is_Not_Thrown_When_Passed_Incorrect_Type() { var check = new Checkers.Check(); check.That(_unknownPerson.DateTimeItem).Function<Person>(x => x.Number == 31337).Or("passed DateTime, expected Person"); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1); Assert.IsTrue(check.FailMessages[0] == "passed DateTime, expected Person"); }
public void TwoFailingChecks() { var check = new Checkers.Check(); const string expected = "Number is not 31338 or lt 2"; check.That(_unknownPerson.Number).Is(31338).And().IsLessThan(2).Or(expected); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 2); Assert.IsTrue(check.FailMessages[1] == expected, "Message is: " + check.FailMessages[0]); }
public void FailMessage100() { var check = new Checkers.Check(); for (int i = 0; i < 100; i++) { check.That(_unknownPerson.Number).Is(2).Or("Wow, 2?"); } Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 100, "Count was: " + check.FailMessages.Count); }
public void FailingTestWithVerboseOr() { var check = new Checkers.Check(); const string expected = "Name is not 31338"; check.That(_unknownPerson.Name).Is(31338).OrSetCheckToFailedAndAddMessage(expected); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1); Assert.IsTrue(check.FailMessages[0] == expected, "Message is: " + check.FailMessages[0]); }
public void MultipleThatsWillWork() { //I have not tested this much....not sure I would do this... var check = new Checkers.Check(); check.That(_unknownPerson).Is(31338).That(2).IsA(typeof(string)); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 2); //Assert.IsTrue(check.FailMessages[0] == "3", "Message is: " + check.FailMessages[0]); }
public void NoMoreTestsAfterFail() { var check = new Checkers.Check(); check.That(_unknownPerson.Number).Is(31338).Or("Wow, thats to much person for me").Fail(); check.That(_unknownPerson.Number).Is(2).Or("Wow, 2?"); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1); Assert.IsTrue(check.FailMessages[0] == "Wow, thats to much person for me", "Message is not 'Wow, thats to much person for me'"); }
public void FailWithMessageShouldOverrideMessages() { var check = new Checkers.Check(); check.That(_unknownPerson.Number).Is(2).Or("Wow, 2?"); check.That(_unknownPerson.Number).Is(31338).Or("Wow, thats to much person for me").Fail("FAIL!FTW"); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1); Assert.IsTrue(check.FailMessages[0] == "FAIL!FTW", "Message is not 'FAIL!FTW' it is:" + check.FailMessages[0]); }
public void IsWillTryCastIntsToStringAndFailCheck() { var check = new Checkers.Check(); const string expected = "number is not a string"; check.That(_unknownPerson.Number).Is("string").Or(expected); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1, "actual: " + check.FailMessages.Count); Assert.IsTrue(check.FailMessages[0] == expected, "Message is:" + check.FailMessages[0]); }
public void IsWillTryCastStringToIntAndFailCheck() { var check = new Checkers.Check(); const string expected = "string is not a number"; check.That(_unknownPerson.Name).Is(456).Or(expected); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1, "actual: " + check.FailMessages.Count); Assert.IsTrue(check.FailMessages[0] == expected, "Message is:" + check.FailMessages[0]); }
public void IsGreaterThanOrEqualToDefaultFail() { var check = new Checkers.Check(); check.That(_unknownPerson.Number).IsGreaterThanOrEqualTo(31338); var actual = check.FailMessages[0]; var expected = _unknownPerson.Number + " is not gt or eq " + 31338; Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1); Assert.IsTrue(check.FailMessages[0] == expected, "Message is: " + actual); }
public void CallFailAndRunn1000MoreChecks() { var check = new Checkers.Check(); check.That(_unknownPerson.Number).Is(2).Or("Wow, 2?").Fail(); for (int i = 0; i < 1000; i++) { check.That(_unknownPerson.Name).Is("Walter").Or("Who are you?"); } Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1, "Count was: " + check.FailMessages.Count); }
public void IsNotNullOrFail() { var check = new Checkers.Check(); check.That(_unknownPerson.Number).IsNotNull().Or("Person Number Is Null!"); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1, "actual: " + check.FailMessages.Count); var actual = check.FailMessages[0]; var expected = "Person Number Is Null!"; Assert.IsTrue(check.FailMessages[0] == expected, "Message is: " + actual); }
public void IsNullDefaultFail() { var check = new Checkers.Check(); check.That(_unnamedPerson.Number).IsNull(); var actual = check.FailMessages[0]; const string expected = "That(item) is not null"; Assert.IsTrue(check.Failed == true, "Did not fail."); Assert.IsTrue(check.FailMessages.Count == 1, "actual: " + check.FailMessages.Count); Assert.IsTrue(check.FailMessages[0] == expected, "Message is: " + actual); }
public void SingleCheck_Multiple_Or_LastOrWillHavePresidence_DontDoThis() { var check = new Checkers.Check(); const string expected = "FirstOr"; const string expected2 = "SecondOr"; check.That(_unknownPerson.Name).Is(31338).Or(expected).Or(expected2); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1); Assert.IsTrue(check.FailMessages[0] == expected2, "Message is: " + check.FailMessages[0]); }
public void IsGreaterThanOrEqualToOrFail() { var check = new Checkers.Check(); const string expected = "Person is not at least 31338. FAIL!"; check.That(_unknownPerson.Number).IsGreaterThanOrEqualTo(31338).Or(expected); var actual = check.FailMessages[0]; Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1, "actual: " + check.FailMessages.Count); Assert.IsTrue(check.FailMessages[0] == expected, "Message is: " + actual); }
public void FailWithMessageShouldOverrideMessagesEvenIfChecksFailAfterFail() { var check = new Checkers.Check(); check.That(_unknownPerson.Number).Is(2).Or("Wow, 2?"); check.That(_unknownPerson.Number).Is(31338).Or("Wow, thats to much person for me").Fail("FAIL!FTW"); check.That(_unknownPerson.Number).Is(42).Or("WFT, 42?"); check.That(_unknownPerson.Name).Is("Jon").Or("OMG! YOU ARE NOT THE Jon!"); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1); Assert.IsTrue(check.FailMessages[0] == "FAIL!FTW", "Message is not 'FAIL!FTW' it is:" + check.FailMessages[0]); }
public void FailMessage1() { var check = new Checkers.Check(); const string expected1 = "Wow, thats not 31338"; const string expected2 = "Expected 2, got something else."; check.That(_unknownPerson.Number).Is(31338).Or(expected1); check.That(_unknownPerson.Number).Is(2).Or(expected2); Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 2); Assert.IsTrue(check.FailMessages[0] == expected1, "Message is: " + check.FailMessages[0]); Assert.IsTrue(check.FailMessages[1] == expected2, "Message is :" + check.FailMessages[0]); }
public void Check_Check() { //Here goes nothing. var check = new Checkers.Check(); check.That("This String Value").Is("This String Value").And().IsA(typeof(string)).IsLessThan(3).Or("String is not lt 3"); //fail Console.WriteLine("FailMessages:" + check.FailMessages.Count); foreach (string messsage in check.FailMessages) { Console.WriteLine("FailMessage:" + messsage); } Assert.IsTrue(check.Failed == true); Assert.IsTrue(check.FailMessages.Count == 1); Assert.IsTrue(check.FailMessages[0] == "String is not lt 3"); }
public void CheckAllTheWayDown_DoThis() { //Here goes nothing. var check = new Checkers.Check(); check.That(_unknownPerson).Is(31338); //fail check.That(2).IsA(typeof(string)).Or("2 is not a string fail"); //fail check.That(_unknownPerson.Name).Is("Rob").Or("Not Rob"); //pass check.That(4).IsGreaterThan(3).Or("4 is gt 3"); //pass check.That(3).IsGreaterThan(4).Or("3 is not gt 4...dumbass"); //fail check.That("This String Value").Is("This String Value").And().IsA(typeof(string)).IsLessThan(3).Or("String is not lt 3"); //fail Console.WriteLine("FailMessages:" + check.FailMessages.Count); foreach (string messsage in check.FailMessages) { Console.WriteLine("FailMessage:" + messsage); } Assert.IsTrue(check.Failed == true); }
public void Is_ShouldThorwIfThatNotCalled() { var check = new Checkers.Check(); check.Is(31338).Or("Wow, thats to much person for me").Fail(); }