Пример #1
0
        public void DeleteNotFound()
        {
            Mock <ILogger <VehCapabilityRepository> > loggerMoc = VehCapabilityRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = VehCapabilityRepositoryMoc.GetContext();
            var repository = new VehCapabilityRepository(loggerMoc.Object, context);

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

            delete.Should().NotThrow();
        }
Пример #2
0
        public async void DeleteFound()
        {
            Mock <ILogger <VehCapabilityRepository> > loggerMoc = VehCapabilityRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = VehCapabilityRepositoryMoc.GetContext();
            var           repository     = new VehCapabilityRepository(loggerMoc.Object, context);
            VehCapability entity         = new VehCapability();

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

            await repository.Delete(entity.Id);

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

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