public async Task ShouldNotFindUser() { await using (var context = new DbContextFactory().CreateContext()) { var service = new UserServiceFactory().Create(context); FluentActions.Invoking(async() => await service.UpdateUserName(Guid.NewGuid(), "")) .Should().Throw <UserNotFoundException>(); } }
public async Task ShouldAlreadyExist() { await using (var context = new DbContextFactory().CreateContext()) { var service = new UserServiceFactory().Create(context); FluentActions.Invoking(async() => await service.UpdateUserName(new Guid("046E876E-D413-45AF-AC2A-552D7AA46C5C"), "ExistingUser")) .Should().Throw <UserNameAlreadyExistsException>(); } }
public async Task ShouldUpdate() { await using (var context = new DbContextFactory().CreateContext()) { var service = new UserServiceFactory().Create(context); var result = await service.UpdateUserName(new Guid("046E876E-D413-45AF-AC2A-552D7AA46C5C"), "UpdatedName"); result.Should().NotBe("ExistingUser"); result.Should().Be("UpdatedName"); } }