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));
        }
Пример #4
0
 /// <summary>
 /// Get any objects that cause the delegate function to return true
 /// </summary>
 public abstract T[] Get(GetItemHandler <T> function);
Пример #5
0
 /// <summary>
 /// Applies the action contained in a delegate function
 /// </summary>
 /// <param name="function">Delegate function with parameters for attribute and index</param>
 public abstract void ForEach(GetItemHandler <T> function);