public BoatClassServiceTests() { var options = new DbContextOptionsBuilder <SailScoresContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; _context = new SailScoresContext(options); var config = new MapperConfiguration(opts => { opts.AddProfile(new DbToModelMappingProfile()); }); _mapper = config.CreateMapper(); _fakeBoatClass = new BoatClass { Id = Guid.NewGuid(), Name = "Fake BoatClass" }; _context.BoatClasses.Add(_mapper.Map <Database.Entities.BoatClass>(_fakeBoatClass)); _context.SaveChanges(); _service = new SailScores.Core.Services.BoatClassService( _context, _mapper ); }
public async Task Delete(Guid announcementId) { var dbEntity = await _dbContext.Announcements.SingleAsync(a => a.Id == announcementId); dbEntity.IsDeleted = true; _dbContext.SaveChanges(); }
public ClubRequestServiceTests() { var options = new DbContextOptionsBuilder <SailScoresContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; _context = new SailScoresContext(options); var config = new MapperConfiguration(opts => { opts.AddProfile(new DbToModelMappingProfile()); }); _mapper = config.CreateMapper(); _fakeInProcessClubRequest = new ClubRequest() { Id = Guid.NewGuid(), ClubName = "InProcessClubRequestName" }; _fakeCompletedClubRequest = new ClubRequest() { Id = Guid.NewGuid(), ClubName = "CompletedClubRequestName", Complete = true }; _context.ClubRequests.Add(_mapper.Map <Database.Entities.ClubRequest>( _fakeInProcessClubRequest)); _context.ClubRequests.Add(_mapper.Map <Database.Entities.ClubRequest>( _fakeCompletedClubRequest)); _context.SaveChanges(); _context = new SailScoresContext(options); _service = new SailScores.Core.Services.ClubRequestService( _context, _mapper ); }