public void Test_ShouldHaveReadWriteRule_WriteNotNew_WhenIsNot_ShouldAssertFalse() { //---------------Set up test pack------------------- var propDef = GetPropDef(); propDef.ReadWriteRule = PropReadWriteRule.ReadOnly; const PropReadWriteRule expectedReadWriteRule = PropReadWriteRule.WriteNotNew; var tester = new PropDefTester(propDef); //---------------Assert Precondition---------------- Assert.AreNotEqual(expectedReadWriteRule, propDef.ReadWriteRule); //---------------Test Result ----------------------- try { tester.ShouldHaveReadWriteRule(expectedReadWriteRule); Assert.Fail("Expected to throw an AssertionException"); } //---------------Test Result ----------------------- catch (AssertionException ex) { var expected = string.Format( "The Property '{0}' for class '{1}' should have a ReadWriteRule '{2}' but is '{3}'", propDef.PropertyName, propDef.ClassName, expectedReadWriteRule, propDef.ReadWriteRule); StringAssert.Contains(expected, ex.Message); } }
public void Test_ShouldHaveReadWriteRule_WriteNotNew_WhenIs_ShouldAssertTrue() { //---------------Set up test pack------------------- var propDef = GetPropDef <FakeBOWithReadWriteRuleProp>("ReadWriteRuleWriteNotNew"); propDef.ReadWriteRule = PropReadWriteRule.WriteNotNew; var tester = new PropDefTester(propDef); //---------------Assert Precondition---------------- Assert.AreEqual(PropReadWriteRule.WriteNotNew, propDef.ReadWriteRule); //---------------Execute Test ---------------------- tester.ShouldHaveReadWriteRule(PropReadWriteRule.WriteNotNew); //---------------Test Result ----------------------- Assert.IsTrue(true, "If it has got here then passed"); }
public void Test_ShouldHaveReadWriteRule_ReadOnly_WhenIs_ShouldAssertTrue() { //---------------Set up test pack------------------- var propDef = GetPropDef(); propDef.ReadWriteRule = PropReadWriteRule.ReadOnly; var tester = new PropDefTester(propDef); //---------------Assert Precondition---------------- Assert.AreEqual(PropReadWriteRule.ReadOnly, propDef.ReadWriteRule); //---------------Execute Test ---------------------- tester.ShouldHaveReadWriteRule(PropReadWriteRule.ReadOnly); //---------------Test Result ----------------------- Assert.IsTrue(true, "If it has got here then passed"); }