Ejemplo n.º 1
0
        public void TestDeleteVote()
        {
            Vote a = new Vote()
            {
                VoteId        = 1,
                EndDate       = DateTime.Now.AddDays(2),
                YesNoQuestion = "1",
                Deleted       = false,
                Yes           = 2,
                No            = 1
            };

            var mockVoteValidator = new Mock <IVoteValidator>();

            mockVoteValidator.Setup(x => x.DeleteVote(1)).Verifiable();
            mockVoteValidator.Setup(x => x.secure(null)).Verifiable();
            mockVoteValidator.Setup(x => x.AtmSecure(null)).Verifiable();

            var controller        = new VotesController(mockVoteValidator.Object);
            var controllerContext = new HttpControllerContext();
            var request           = new HttpRequestMessage();

            request.Headers.Add("TODO_PAGOS_TOKEN", "1");
            controllerContext.Request    = request;
            controller.ControllerContext = controllerContext;

            IHttpActionResult actionResult = controller.DeleteVote(1);
            var contentResult = actionResult as OkNegotiatedContentResult <IEnumerable <Vote> >;

            Assert.IsNotNull(actionResult);
        }