public void The_Presenter_Changes_The_Name_On_The_Relationship()
        {
            IMainPanel        mainPanel    = MockRepository.GenerateStub <IMainPanel>();
            IRelationshipForm form         = MockRepository.GenerateStub <IRelationshipForm>();
            Relationship      relationship = TestHelper.GetRelationship();

            var presenter = new RelationshipPresenter(mainPanel, form);

            presenter.AttachToModel(relationship);

            form.RelationshipName = "NewName";
            form.GetEventRaiser(f => f.RelationshipNameChanged += null).Raise(form, new EventArgs());

            Assert.That(relationship.Name, Is.EqualTo("NewName"));
        }
        public void The_Presenter_Fills_In_The_Form()
        {
            IMainPanel        mainPanel = MockRepository.GenerateStub <IMainPanel>();
            IRelationshipForm form      = MockRepository.GenerateMock <IRelationshipForm>();

            Relationship relationship = TestHelper.GetRelationship();

            var presenter = new RelationshipPresenter(mainPanel, form);

            presenter.AttachToModel(relationship);

            form.AssertWasCalled(f => f.Clear());
            form.AssertWasCalled(f => f.RelationshipName = "Name");
            form.AssertWasCalled(f => f.PrimaryKey       = relationship.PrimaryKey);
            form.AssertWasCalled(f => f.ForeignKey       = relationship.ForeignKey);
            form.AssertWasCalled(f => f.SetPossiblePrimaryKeys(null), c => c.IgnoreArguments());
            form.AssertWasCalled(f => f.SetPossibleForeignKeys(null), c => c.IgnoreArguments());
            form.AssertWasCalled(f => f.SetVirtualProperties(relationship.Ex));
        }