Exemplo n.º 1
0
        public async Task ItShouldReturnTypeOfNetbsadStrategy()
        {
            await Task.Run(() =>
            {
                DisbsadStrategy disbsadStrategy = new DisbsadStrategy(_mockMediator.Object);

                Assert.NotNull(disbsadStrategy);
                Assert.IsType <DisbsadStrategy>(disbsadStrategy);
            });
        }
Exemplo n.º 2
0
        public async Task ItShouldCallMediatorSendMethodExactlyOnceWhenExecuteStrategyCalled()
        {
            await Task.Run(() =>
            {
                Item item = new Item()
                {
                    ItemPath = "Inbound/path",
                    ItemId   = "location"
                };

                ValidatedDisbsadCommand command = new ValidatedDisbsadCommand(item);
                _mockMediator.Setup(x => x.Send(command, new System.Threading.CancellationToken()))
                .Returns(Task.FromResult(new BusinessValidationProxy()));

                IBusinessValidationStrategy disbsadStrategy = new DisbsadStrategy(_mockMediator.Object);

                Task <BusinessValidationProxy> result = disbsadStrategy.ExecuteStrategy(string.Empty, item);

                _mockMediator.Verify(
                    v => v.Send(It.IsAny <ValidatedDisbsadCommand>(), It.IsAny <CancellationToken>())
                    , Times.Exactly(1));
            });
        }