예제 #1
0
        public async Task Delete_ShouldGetUserNameAndIncludeInMessage()
        {
            //Data
            var guid = Guid.NewGuid();

            //Setup
            _mockUserManagerWrapper.Setup(x => x.FindByNameAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(new User {
                Id = "test"
            })).Verifiable();
            _mockEndpointInstance.Setup(x => x.Send(It.Is <DeleteListCommand>(y => y.Id == guid && y.UserId == "test"), It.IsAny <SendOptions>()))
            .Returns(Task.CompletedTask).Verifiable();
            var listController    = new ListController(_mockEndpointInstance.Object, _mockUserManagerWrapper.Object);
            var controllerContext = new ControllerContext
            {
                HttpContext = _httpContext.Object
            };

            listController.ControllerContext = controllerContext;

            //Test
            var result = await listController.Delete(guid) as OkResult;

            Assert.NotNull(result);
            Assert.AreEqual(200, result.StatusCode);

            //Analysis
            _mockUserManagerWrapper.Verify();
            _mockEndpointInstance.Verify();
        }
예제 #2
0
        public override void Run()
        {
            if (!(Owner is ListController))
            {
                return;
            }
            ListController controller = this.Owner as ListController;

            controller.Delete();
        }
예제 #3
0
        public void Delete()
        {
            // Arrange
            ListController controller = new ListController();

            // Act
            controller.Delete(5);

            // Assert
        }