// ReSharper disable InconsistentNaming public void Test_CreateMultipleRelDefTester() { //---------------Set up test pack------------------- var relationshipDef = MockRepository.GenerateStub<IRelationshipDef>(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var tester = new MultipleRelDefTester(relationshipDef); //---------------Test Result ----------------------- Assert.AreSame(relationshipDef, tester.MultipleRelationshipDef); }
// ReSharper disable InconsistentNaming public void Test_CreateMultipleRelDefTester() { //---------------Set up test pack------------------- var relationshipDef = MockRepository.GenerateStub <IRelationshipDef>(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var tester = new MultipleRelDefTester(relationshipDef); //---------------Test Result ----------------------- Assert.AreSame(relationshipDef, tester.MultipleRelationshipDef); }
public void Test_ShouldHaveDeleteParentAction_Prevent_WhenIs_ShouldAssertTrue() { //---------------Set up test pack------------------- var singleRelationshipDef = CreateMultipleRelationshipDef(DeleteParentAction.Prevent); var tester = new MultipleRelDefTester(singleRelationshipDef); //---------------Assert Precondition---------------- Assert.AreEqual(DeleteParentAction.Prevent, singleRelationshipDef.DeleteParentAction); //---------------Execute Test ---------------------- tester.ShouldHaveDeleteParentAction(DeleteParentAction.Prevent); //---------------Test Result ----------------------- Assert.IsTrue(true, "If it has got here then passed"); }
public void Test_RelationshipName_ShouldReturnMultipleRelationshipDefsRelationshipName() { //---------------Set up test pack------------------- var singleRelationshipDef = CreateMultipleRelationshipDef(); singleRelationshipDef.Stub(def => def.RelationshipName).Return(GetRandomString()); var tester = new MultipleRelDefTester(singleRelationshipDef); //---------------Assert Precondition---------------- Assert.IsNotNullOrEmpty(singleRelationshipDef.RelationshipName); //---------------Execute Test ---------------------- var returnedRelationshipName = tester.RelationshipName; //---------------Test Result ----------------------- Assert.IsNotNull(tester.MultipleRelationshipDef); Assert.AreEqual(singleRelationshipDef.RelationshipName, returnedRelationshipName); }
public void Test_ShouldHaveDeleteParentAction_DereferenceRelated_WhenIsNot_ShouldAssertFalse() { //---------------Set up test pack------------------- var singleRelationshipDef = CreateMultipleRelationshipDef(DeleteParentAction.DoNothing); const DeleteParentAction expectedDeleteParentAction = DeleteParentAction.DereferenceRelated; var tester = new MultipleRelDefTester(singleRelationshipDef); //---------------Assert Precondition---------------- Assert.AreNotEqual(expectedDeleteParentAction, singleRelationshipDef.DeleteParentAction); //---------------Test Result ----------------------- try { tester.ShouldHaveDeleteParentAction(expectedDeleteParentAction); Assert.Fail("Expected to throw an AssertionException"); } //---------------Test Result ----------------------- catch (AssertionException ex) { var expected = string.Format( "should have a DeleteParentAction '{0}' but is '{1}'", expectedDeleteParentAction, singleRelationshipDef.DeleteParentAction); StringAssert.Contains(expected, ex.Message); } }