public async Task RemoveExistingSkill_ReturnsTrue() { var context = new JobFinderDbContext(new DbContextOptionsBuilder <JobFinderDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options); var model = new Skill() { Name = "Skill1", Resume = new Resume() }; await context.AddAsync(model); context.SaveChanges(); var skillService = new SkillService(new EfRepository <Resume>(context), new EfRepository <Skill>(context)); var result = await skillService.RemoveSkill(model.Id); Assert.True(result); var dbModels = await context.Skills.AnyAsync(); Assert.False(dbModels); }
public async Task Delete_Skill_Test() { SkillData data = new SkillData() { Id = "1" }; Assert.AreEqual(1, await skillService.RemoveSkill(data)); }
public async Task RemoveNonExistingSkill_ReturnsFalse() { var context = new JobFinderDbContext(new DbContextOptionsBuilder <JobFinderDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options); var model = new Skill() { Name = "Skill1", }; var skillService = new SkillService(new EfRepository <Resume>(context), new EfRepository <Skill>(context)); var result = await skillService.RemoveSkill(model.Id); Assert.False(result); }
public async Task RemoveSkill([FromBody] SkillData data) { await _service.RemoveSkill(data); }