public async void All()
        {
            Mock <ILogger <ClientCommunicationRepository> > loggerMoc = ClientCommunicationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = ClientCommunicationRepositoryMoc.GetContext();
            var repository = new ClientCommunicationRepository(loggerMoc.Object, context);

            ClientCommunication entity = new ClientCommunication();

            context.Set <ClientCommunication>().Add(entity);
            await context.SaveChangesAsync();

            var record = await repository.All();

            record.Should().NotBeEmpty();
        }
Example #2
0
        public async void Delete()
        {
            Mock <ILogger <ClientCommunicationRepository> > loggerMoc = ClientCommunicationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = ClientCommunicationRepositoryMoc.GetContext();
            var repository             = new ClientCommunicationRepository(loggerMoc.Object, context);
            ClientCommunication entity = new ClientCommunication();

            context.Set <ClientCommunication>().Add(entity);
            await context.SaveChangesAsync();

            await repository.Delete(entity.Id);

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

            modifiedRecord.Should().BeNull();
        }
Example #3
0
        public async void Update_Entity_Is_Not_Tracked()
        {
            Mock <ILogger <ClientCommunicationRepository> > loggerMoc = ClientCommunicationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = ClientCommunicationRepositoryMoc.GetContext();
            var repository             = new ClientCommunicationRepository(loggerMoc.Object, context);
            ClientCommunication entity = new ClientCommunication();

            context.Set <ClientCommunication>().Add(entity);
            await context.SaveChangesAsync();

            await repository.Update(new ClientCommunication());

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

            modifiedRecord.Should().NotBeNull();
        }