public async Task throws_when_aggregate_not_found(CreateCalendarItemCommand createCommand, DeleteCalendarItemCommand deleteCommand)
        {
            createCommand.EndDate = createCommand.StartDate.AddDays(1);
            await CreateCommandHandler.HandleAsync(createCommand);

            var exception = await Record.ExceptionAsync(() => act(deleteCommand));

            exception.ShouldBeOfType(typeof(AwesomeCalendarException));
        }
Beispiel #2
0
        public void HandleAsync_ValidCommand_Ok()
        {
            _mockDispatcher.Setup(x => x.Publish(It.IsAny <OpenCqrsCli.Events.Product.CreatingEvent>()));
            var data = new List <Models.Product>();

            _mockProductRepository.Setup(x => x.GetAll()).Returns(data);

            // Mapper initialize???

            var command = new OpenCqrsCli.Commands.Product.CreateCommand {
            };
            var result  = _sut.HandleAsync(command).Result;

            Assert.IsNotNull(result);
            Assert.AreEqual(typeof(System.Threading.Tasks.Task <IEnumerable <OpenCqrs.Events.IEvent> >), result.GetType());

            _mockDispatcher.VerifyAll();
            _mockProductRepository.VerifyAll();
        }