- 
                Notifications
    
You must be signed in to change notification settings  - Fork 358
 
Open
Description
My Create handler uses AutoMapper to map from command to entity.
public async Task<int> Handle(Command command, CancellationToken cancellationToken)
            {
                var entity = _mapper.Map<ExampleEntity>(command);
                await _db.ExampleEntity.AddAsync(entity, cancellationToken);
                await _db.SaveChangesAsync(cancellationToken);
                return entity.Id;
            }
My test looks like this
var command = new Create.Command
{
    Name = "Example 1",
     ...
};
var id = await _fixture.SendAsync(command, mapper);
id.ShouldNotBeNull();
When I run the test I get "Object reference not set to an instance of an object." because _maper is null;
I know I probably need to modify the SliceFixture but can't figure out what to do.
Metadata
Metadata
Assignees
Labels
No labels