Ejemplo n.º 1
0
        public async void Create()
        {
            Mock <ILogger <TicketStatuRepository> > loggerMoc = TicketStatuRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = TicketStatuRepositoryMoc.GetContext();
            var repository = new TicketStatuRepository(loggerMoc.Object, context);

            var entity = new TicketStatu();
            await repository.Create(entity);

            var record = await context.Set <TicketStatu>().FirstOrDefaultAsync();

            record.Should().NotBeNull();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        public async void Delete()
        {
            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();

            await repository.Delete(entity.Id);

            TicketStatu modifiedRecord = await context.Set <TicketStatu>().FirstOrDefaultAsync();

            modifiedRecord.Should().BeNull();
        }
Ejemplo n.º 4
0
        public async void Update_Entity_Is_Not_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();

            await repository.Update(new TicketStatu());

            var modifiedRecord = context.Set <TicketStatu>().FirstOrDefaultAsync();

            modifiedRecord.Should().NotBeNull();
        }