public void TestGetSkillById() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var repository = new EfDeletableEntityRepository <Skill>(new ApplicationDbContext(options.Options)); var userSkillRepository = new EfRepository <UsersSkill>(new ApplicationDbContext(options.Options)); repository.AddAsync(new Skill() { Name = "test" }).GetAwaiter().GetResult(); repository.SaveChangesAsync().GetAwaiter().GetResult(); var skillsService = new SkillsService(repository, userSkillRepository); AutoMapperConfig.RegisterMappings(typeof(CategoryServicesTests.MyTestPost).Assembly); var post = skillsService.GetById(1); Assert.Equal("test", post.Name); }