Ejemplo n.º 1
0
        public async Task ShouldNotFindUser()
        {
            await using (var context = new DbContextFactory().CreateContext())
            {
                var service = new UserServiceFactory().Create(context);

                FluentActions.Invoking(async() => await service.Destroy(Guid.NewGuid()))
                .Should().Throw <UserNotFoundException>();
            }
        }
Ejemplo n.º 2
0
        public async Task ShouldDestroyUser()
        {
            await using (var context = new DbContextFactory().CreateContext())
            {
                var service = new UserServiceFactory().Create(context);

                var id = new Guid("046E876E-D413-45AF-AC2A-552D7AA46C5C");
                await service.Destroy(id);

                var result = await context.Users.FirstOrDefaultAsync(x => x.Id == id);

                result.Should().BeNull();
            }
        }