public async void Get() { Mock <ILogger <TicketStatuRepository> > loggerMoc = TicketStatuRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = TicketStatuRepositoryMoc.GetContext(); var repository = new TicketStatuRepository(loggerMoc.Object, context); TicketStatu entity = new TicketStatu(); context.Set <TicketStatu>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.Id); record.Should().NotBeNull(); }
public async void Update_Entity_Is_Tracked() { Mock <ILogger <TicketStatuRepository> > loggerMoc = TicketStatuRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = TicketStatuRepositoryMoc.GetContext(); var repository = new TicketStatuRepository(loggerMoc.Object, context); TicketStatu entity = new TicketStatu(); context.Set <TicketStatu>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.Id); await repository.Update(record); var modifiedRecord = context.Set <TicketStatu>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }