Esempio n. 1
0
        public void Verify_EditAction_MustHaveAuthorizeRolesAttribute()
        {
            PropertyController controller = new PropertyController(mockAppUriResolver.Object, mockUserAccountResolver.Object);
            var hasAttribute = TestHelper.MethodHasAuthorizeAttribute(() => controller.Edit(2));

            Assert.IsTrue(hasAttribute);
        }
        public void Edit_Not_Null()
        {
            int propertyId = 1;
            PropertyController controller = new PropertyController(propertyService, tenantService);

            ViewResult result = controller.Edit(propertyId) as ViewResult;

            Assert.That(result, Is.Not.Null);
        }
Esempio n. 3
0
        public void Verify_EditAction_with_Role_Sales_Returns_Edit_View(StaffType staffType)
        {
            mockUserAccountResolver.Setup(x => x.GetCurrentUserRole()).Returns((int)staffType);

            PropertyController controller = new PropertyController(mockAppUriResolver.Object, mockUserAccountResolver.Object);
            var resultTask = controller.Edit(2);

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

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