Ejemplo n.º 1
0
        public void Verify_DeleteAction_MustHaveAuthorizeRolesAttribute()
        {
            PropertyController controller = new PropertyController(mockAppUriResolver.Object, mockUserAccountResolver.Object);
            var hasAttribute = TestHelper.MethodHasAuthorizeAttribute(() => controller.Delete(2));

            Assert.IsTrue(hasAttribute);
        }
Ejemplo n.º 2
0
        public void Verify_DeleteAction_Only_Role_SalesDepartmentAdmin_Can_Execute()
        {
            mockUserAccountResolver.Setup(x => x.GetCurrentUserRole()).Returns((int)StaffType.IsSalesDepartmentAdmin);

            PropertyController controller = new PropertyController(mockAppUriResolver.Object, mockUserAccountResolver.Object);
            var resultTask = controller.Delete(3);

            resultTask.Wait();
            var viewResult = resultTask.Result as ViewResult;

            Assert.IsNotNull(viewResult);
            Assert.AreEqual("EditSalesAdmin", viewResult.ViewName);
        }