示例#1
0
        public void WhenOptionValueIsNull_ThrowInvalidObjectException()
        {
            _optionsMock.Setup(t => t.Value).Returns(() => new PublisherServiceEndPointConstants());

            _service = new PublisherServiceDispatcher(null, _optionsMock.Object);
            Assert.Throws <InvalidOperationException>(() => _service.RouteToPublisherDelete("5c9f2f04f1d4914a40f7580c"));
        }
示例#2
0
        public void WhenDispatchOperation_IsSuccessful_VerifyDispatchCalledOnce()
        {
            _optionsMock.Setup(t => t.Value).Returns(() => new PublisherServiceEndPointConstants
            {
                Delete = "http://api.com/delete"
            });


            _service = new PublisherServiceDispatcher(_dispatcherMock.Object, _optionsMock.Object);

            _service.RouteToPublisherDelete("5c9f2f04f1d4914a40f7580c");

            _dispatcherMock.Verify(
                t => t.Dispatch <object, object>(null, It.IsAny <string>(), null, HttpRequestCode.DELETE, null, null),
                Times.Once);
        }