public void Test_ShouldNotHaveDefault_WhenHasDefault_ShouldAssertFalse() { //---------------Set up test pack------------------- var propDef = GetPropDef(); propDef.DefaultValueString = "Fdafasdfasdfasd"; var tester = new PropDefTester(propDef); //---------------Assert Precondition---------------- Assert.IsNotNullOrEmpty(propDef.DefaultValueString); //---------------Test Result ----------------------- try { tester.ShouldNotHaveDefault(); Assert.Fail("Expected to throw an AssertionException"); } //---------------Test Result ----------------------- catch (AssertionException ex) { var expected = string.Format( "The Property '{0}' for class '{1}' should not have a default but does", propDef.PropertyName, propDef.ClassName); StringAssert.Contains(expected, ex.Message); } }
public void Test_ShouldNotHaveDefault_WhenNotHasDefault_ShouldAssertTrue() { //---------------Set up test pack------------------- var propDef = GetPropDef(); var tester = new PropDefTester(propDef); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- tester.ShouldNotHaveDefault(); //---------------Test Result ----------------------- Assert.IsTrue(true, "If it has got here then passed"); }