Beispiel #1
0
        public void CheckAppUserExistAfterDelete()
        {
            //Arrange
            AppUser appUser1 = new AppUser()
            {
                Id        = 66,
                FirstName = "test",
                LastName  = "test"
            };
            AppUser appUser2 = new AppUser()
            {
                Id        = 77,
                FirstName = "test",
                LastName  = "test"
            };

            var options = new DbContextOptionsBuilder <Context>()
                          .UseInMemoryDatabase(databaseName: "UsersDirectoryMVC")
                          .Options;

            using (var context = new Context(options))
            {
                //Act
                var appUserRepository = new AppUserRepository(context);
                appUserRepository.AddAppUser(appUser1);
                appUserRepository.AddAppUser(appUser2);
                appUserRepository.DeleteAppUser(66);
                var getAppUser1 = appUserRepository.GetAppUser(66);
                var getAppUser2 = appUserRepository.GetAppUser(77);
                //Assert
                getAppUser1.Should().BeNull();
                getAppUser2.Should().Equals(appUser2);
            }
        }