Beispiel #1
0
        public async Task ShouldFailNonUniqueUser()
        {
            await using (var context = new DbContextFactory().CreateContext())
            {
                var service = new UserServiceFactory().Create(context);

                NewUserBody user = new NewUserBody()
                {
                    Email    = "*****@*****.**",
                    Password = "******",
                    UserName = "******"
                };

                FluentActions.Invoking(async() => await service.Create(user))
                .Should().Throw <UserAlreadyExistsException>();
            }
        }
Beispiel #2
0
        public async Task ShouldCreateNewUser()
        {
            await using (var context = new DbContextFactory().CreateContext())
            {
                var service = new UserServiceFactory().Create(context);

                NewUserBody user = new NewUserBody()
                {
                    Email       = "*****@*****.**",
                    Password    = "******",
                    FirstName   = "Joe",
                    LastName    = "Blogs",
                    UserName    = "******",
                    PhoneNumber = "1111111111",
                    Avatar      = new byte[100],
                    DateOfBirth = DateTime.Now.AddYears(-18)
                };

                await service.Create(user);
            }
        }