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.UpdateUserName(Guid.NewGuid(), ""))
                .Should().Throw <UserNotFoundException>();
            }
        }
Ejemplo n.º 2
0
        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>();
            }
        }
Ejemplo n.º 3
0
        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");
            }
        }