Ejemplo n.º 1
0
        public void GetSaleStateChange_ConstructsQuery_WhenResultOfDispatchIsNull_ReturnsNotFound()
        {
            var saleId    = TestIds.A;
            var changeId  = TestIds.B;
            var resultDto = new Dto.SaleStateChangeDto();

            _dispatcherMock.Setup(d => d.QueryAsync(It.Is <GetSaleStateChange>(q => q.ParentSaleId == saleId && q.SaleStateChangeId == changeId))).ReturnsAsync((Dto.SaleStateChangeDto)null).Verifiable();

            var actionResult = _controller.GetSaleStateChange(parentSaleId: saleId, saleStateChangeId: changeId).GetAwaiter().GetResult();

            Assert.IsTrue(actionResult.Result is NotFoundResult);
            _dispatcherMock.Verify();
        }
Ejemplo n.º 2
0
        public void GetSaleStateChange_ConstructsQuery_ReturnsResultOfDispatch()
        {
            var saleId    = TestIds.A;
            var changeId  = TestIds.B;
            var resultDto = new Dto.SaleStateChangeDto();

            _dispatcherMock.Setup(d => d.QueryAsync(It.Is <GetSaleStateChange>(q => q.ParentSaleId == saleId && q.SaleStateChangeId == changeId))).ReturnsAsync(resultDto).Verifiable();

            var actionResult = _controller.GetSaleStateChange(parentSaleId: saleId, saleStateChangeId: changeId).GetAwaiter().GetResult();

            Assert.AreEqual(resultDto, actionResult.Value);
            _dispatcherMock.Verify();
        }