예제 #1
0
        public ActionResult SignPetition(int petitionId)
        {
            var service = new PetitionService();

            service.Sign(petitionId, User.Identity.GetUserId());

            var model = service.GetPetition(petitionId, User.Identity.GetUserId());

            return(PartialView("_Sign", model));
        }
예제 #2
0
        public void SignPetition_OneUser_OneUSerSigned()
        {
            var creator = Helpers.CreateNewUser();
            var signer  = Helpers.CreateNewUser();

            var pettition = Helpers.CreateNewPetition(creator);

            try
            {
                var service = new PetitionService();

                service.Sign(pettition, signer.Id);

                var actualPetition = service.GetPetition(pettition);

                Assert.AreEqual(1, actualPetition.Signatures);
            }
            finally
            {
                Helpers.DeleteUser(signer);
                Helpers.DeleteUser(creator);
            }
        }