コード例 #1
0
        public async Task ReturnsUnitWhenCarNotFound()
        {
            var dbContext = DbContextFactory.CreateInMemory();
            var handler   = new DeleteCarCommandHandler(dbContext);
            var result    = await handler.Handle(generator.DeleteCommand, default);

            Assert.StrictEqual(MediatR.Unit.Value, result);
        }
コード例 #2
0
        public async Task ReturnsUnitWhenCarFound()
        {
            var dbContext = DbContextFactory.CreateInMemory();
            var entity    = generator.Entity;

            dbContext.Cars.Add(entity);
            await dbContext.SaveChangesAsync();

            var handler = new DeleteCarCommandHandler(dbContext);
            var result  = await handler.Handle(new DeleteCarCommand { Id = entity.PublicId }, default);

            Assert.StrictEqual(MediatR.Unit.Value, result);
        }