예제 #1
0
        public async Task Handle_InvalidDeleteUserByNameRequest_ReturnsError()
        {
            var request = new DeleteUserByNameRequest {
                Name = "NonUser"
            };
            var response = await Mediator.HandleAsync(request);

            Assert.IsTrue(response.HasErrors);
            Assert.IsFalse(Context.Set <User>().First().IsDeleted);
        }
예제 #2
0
        public async Task Handle_DeleteUserByNameRequest_DeletesUser()
        {
            var request = new DeleteUserByNameRequest
            {
                Name = _user.Name
            };

            var response = await Mediator.HandleAsync(request);

            Assert.IsFalse(response.HasErrors);
            var user = Context.Set <User>().FirstOrDefault();

            Assert.NotNull(user);
            Assert.IsTrue(user.IsDeleted);
        }