Пример #1
0
        public void CallGetAllUsersOnce()
        {
            // Arrange
            var    mockedMappingService  = new Mock <IMappingService>();
            var    mockedArticlesService = new Mock <IArticleService>();
            var    mockedUserService     = new Mock <IUserService>();
            string id = Guid.NewGuid().ToString();

            var controller = new PanelController(
                mockedMappingService.Object,
                mockedUserService.Object,
                mockedArticlesService.Object);

            // Act
            controller.DeleteUser(id);

            // Assert
            mockedUserService.Verify(x => x.GetAllUsers(), Times.Once);
        }
Пример #2
0
        public void CallMapOnce()
        {
            // Arrange
            var    mockedMappingService  = new Mock <IMappingService>();
            var    mockedArticlesService = new Mock <IArticleService>();
            var    mockedUserService     = new Mock <IUserService>();
            string id = Guid.NewGuid().ToString();

            var controller = new PanelController(
                mockedMappingService.Object,
                mockedUserService.Object,
                mockedArticlesService.Object);

            // Act
            controller.DeleteUser(id);

            // Assert
            mockedMappingService.Verify(x => x.Map <IEnumerable <UserViewModel> >(It.IsAny <IEnumerable <User> >()), Times.Once);
        }