Example #1
0
        public void index_should_return()
        {
            // Act
            var controller = new AdminController(null, null, null);
            var view = controller.Index();

            // Assert
            Assert.NotNull(view);
            controller.AssertGetAttribute("Index");
        }
Example #2
0
        public void new_translator_should_return_with_user_model()
        {
            // Act
            var controller = new AdminController(null, null, null);
            var view = controller.NewTranslator();
            var model = view.Model;

            // Assert
            Assert.NotNull(view);
            Assert.NotNull(model);
            Assert.IsAssignableFrom(typeof(UserModel), model);
            controller.AssertGetAttribute("NewTranslator");
        }
Example #3
0
        public void users_should_return_with_app_model()
        {
            // Arrange           
            var userService = new Mock<IUserService>();

            // Act
            var controller = new AdminController(userService.Object, null, null);
            var view = controller.Users(1);

            // Assert
            Assert.NotNull(view);
            controller.AssertGetAttribute("Users");
            userService.Verify(x => x.GetAllByRoleId(1), Times.Once);

            view = controller.Users(8);     // Methodta id>0 && id<4 olduğu için iki ayrı kontrol yaptık.

            // Assert
            Assert.NotNull(view);
            controller.AssertGetAttribute("Users");
            userService.Verify(x => x.GetAll(), Times.Once);
        }
Example #4
0
        public void apps_should_return_with_app_model()
        {
            // Arrange           
            var appService = new Mock<IAppService>();

            // Act
            var controller = new AdminController(null, null, appService.Object);
            var view = controller.Apps();

            // Assert
            Assert.NotNull(view);
            controller.AssertGetAttribute("Apps");
            appService.Verify(x => x.GetAll(), Times.Once);
        }