コード例 #1
0
        public void Index_Action_Returns_View()
        {
            var controller = new MemberController(donationsService, memberService, campaignService);
            var result = controller.Index();

            result.AssertViewRendered();
        }
コード例 #2
0
        public void Add_Action_Returns_View_With_ViewModel()
        {
            var controller = new MemberController(donationsService, memberService, campaignService);
            var result = controller.Add();

            result.AssertViewRendered().WithViewData<MemberEditViewModel>();
        }
コード例 #3
0
        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>();
        }
コード例 #4
0
        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>();
        }
コード例 #5
0
        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");
        }
コード例 #6
0
        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");
        }