public void getitem_should_thrown_exception_with_null_id() { var sut = new GetItemHandler(new ItemRepository(_catalogDataContextFactory.ContextInstance), new Mapper(new MapperConfiguration(cfg => cfg.AddProfile <CatalogProfile>()))); sut.Handle(null, CancellationToken.None).ShouldThrow <ArgumentNullException>(); }
public async Task getitem_should_return_right_data(string guid) { var sut = new GetItemHandler(new ItemRepository(_catalogDataContextFactory.ContextInstance), new Mapper(new MapperConfiguration(cfg => cfg.AddProfile <CatalogProfile>()))); var result = await sut.Handle(new GetItemCommand { Id = new Guid(guid) }, CancellationToken.None); result.Id.ShouldBe(new Guid(guid)); }
public async Task getitem_should_log_right_information(string guid) { var sut = new GetItemHandler(new ItemRepository(_catalogDataContextFactory.ContextInstance), new Mapper(new MapperConfiguration(cfg => cfg.AddProfile <CatalogProfile>())), _logger.Object); var result = await sut.Handle(new GetItemCommand { Id = new Guid(guid) }, CancellationToken.None); _logger .Verify(x => x.Log(It.IsAny <LogLevel>(), It.IsAny <Exception>(), It.IsAny <string>()), Times.AtMost(1)); }