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

            records.Should().NotBeEmpty();
            records.Count.Should().Be(1);
        }
        public async void Create()
        {
            Mock <ILogger <LocationRepository> > loggerMoc = LocationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = LocationRepositoryMoc.GetContext();
            var repository = new LocationRepository(loggerMoc.Object, context);

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

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

            record.Should().NotBeNull();
        }
        public void DeleteNotFound()
        {
            Mock <ILogger <LocationRepository> > loggerMoc = LocationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = LocationRepositoryMoc.GetContext();
            var repository = new LocationRepository(loggerMoc.Object, context);

            Func <Task> delete = async() =>
            {
                await repository.Delete(default(int));
            };

            delete.Should().NotThrow();
        }
        public async void Create()
        {
            Mock <ILogger <LocationRepository> > loggerMoc = LocationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = LocationRepositoryMoc.GetContext();
            var repository = new LocationRepository(loggerMoc.Object, context);

            var entity = new Location();

            entity.SetProperties(default(int), 2, 2, "B");
            await repository.Create(entity);

            var records = await context.Set <Location>().ToListAsync();

            records.Count.Should().Be(2);
        }
        public async void Get()
        {
            Mock <ILogger <LocationRepository> > loggerMoc = LocationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = LocationRepositoryMoc.GetContext();
            var repository = new LocationRepository(loggerMoc.Object, context);

            Location entity = new Location();

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

            var record = await repository.Get(entity.LocationId);

            record.Should().NotBeNull();
        }
        public async void Delete()
        {
            Mock <ILogger <LocationRepository> > loggerMoc = LocationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = LocationRepositoryMoc.GetContext();
            var      repository          = new LocationRepository(loggerMoc.Object, context);
            Location entity = new Location();

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

            await repository.Delete(entity.LocationId);

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

            modifiedRecord.Should().BeNull();
        }
        public async void Update_Entity_Is_Not_Tracked()
        {
            Mock <ILogger <LocationRepository> > loggerMoc = LocationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = LocationRepositoryMoc.GetContext();
            var      repository          = new LocationRepository(loggerMoc.Object, context);
            Location entity = new Location();

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

            await repository.Update(new Location());

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

            modifiedRecord.Should().NotBeNull();
        }
        public async void DeleteFound()
        {
            Mock <ILogger <LocationRepository> > loggerMoc = LocationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = LocationRepositoryMoc.GetContext();
            var      repository          = new LocationRepository(loggerMoc.Object, context);
            Location entity = new Location();

            entity.SetProperties(default(int), 2, 2, "B");
            context.Set <Location>().Add(entity);
            await context.SaveChangesAsync();

            await repository.Delete(entity.LocationId);

            var records = await context.Set <Location>().ToListAsync();

            records.Count.Should().Be(1);
        }
        public async void Update_Entity_Is_Not_Tracked()
        {
            Mock <ILogger <LocationRepository> > loggerMoc = LocationRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = LocationRepositoryMoc.GetContext();
            var      repository          = new LocationRepository(loggerMoc.Object, context);
            Location entity = new Location();

            entity.SetProperties(default(int), 2, 2, "B");
            context.Set <Location>().Add(entity);
            await context.SaveChangesAsync();

            context.Entry(entity).State = EntityState.Detached;

            await repository.Update(entity);

            var records = await context.Set <Location>().ToListAsync();

            records.Count.Should().Be(2);
        }