コード例 #1
0
        public async void UpdateCurrentLoggedInUserInfoAsyncShouldUpdateValuesAccordingly()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var userRepository      = new EfDeletableEntityRepository <ApplicationUser>(new ApplicationDbContext(options.Options));
            var dogsitterRepository = new EfDeletableEntityRepository <Dogsitter>(new ApplicationDbContext(options.Options));
            var ownerRepository     = new EfDeletableEntityRepository <Owner>(new ApplicationDbContext(options.Options));

            var ownersService = new OwnersService(userRepository, ownerRepository, dogsitterRepository);

            var user = new ApplicationUser();

            await ownersService.CreateOwnerAsync(user, Info, Info, Info, Info, Gender.Male, Info, Info, user.Id, Info);

            await ownersService.UpdateCurrentLoggedInUserInfoAsync(user.Id, "NewName", Info, Info, Info, Info, Info);

            var owner = ownersService.GetOwnerById(user.Id);

            Assert.Equal("NewName", owner.FirstName);
        }