public void Index_Action_Returns_View() { var controller = new MemberController(donationsService, memberService, campaignService); var result = controller.Index(); result.AssertViewRendered(); }
public void Add_Action_Returns_View_With_ViewModel() { var controller = new MemberController(donationsService, memberService, campaignService); var result = controller.Add(); result.AssertViewRendered().WithViewData<MemberEditViewModel>(); }
public void Edit_Action_Returns_Named_View_With_ViewModel() { memberService.Get(1).Returns(new Member()); var controller = new MemberController(donationsService, memberService, campaignService); var result = controller.Edit(1); Assert.That(result.AssertViewRendered().ViewName == "Add"); result.AssertViewRendered().WithViewData<MemberEditViewModel>(); }
public void Donate_Action_Returns_View_With_Model() { memberService.Get(1).Returns(new Member()); campaignService.GetAllOpen().Returns(new List<Campaign>()); var controller = new MemberController(donationsService, memberService, campaignService); var result = controller.Donate(1); result.AssertViewRendered().WithViewData<Donation>(); }
public void Delete_Action_Returns_RedirectToAction() { memberService.Get(1).Returns(new Member()); memberService.Update(new Member()); var controller = new MemberController(donationsService, memberService, campaignService); var result = controller.Delete(1); result.AssertActionRedirect().ToAction("Index"); }
public void QuickDonation_Action_RedirectsToAction() { donationsService.QuickDonation(new Donation()); var controller = new MemberController(donationsService, memberService, campaignService); var result = controller.SaveDonation(new Donation()); result.AssertActionRedirect().ToAction("Index"); }