예제 #1
0
        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);
        }
예제 #2
0
        public async Task Delete_Skill_Test()
        {
            SkillData data = new SkillData()
            {
                Id = "1"
            };

            Assert.AreEqual(1, await skillService.RemoveSkill(data));
        }
예제 #3
0
        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);
        }
예제 #4
0
 public async Task RemoveSkill([FromBody] SkillData data)
 {
     await _service.RemoveSkill(data);
 }