コード例 #1
0
        private IBankConfirmationBlockService BuildConfirmationBlockPostMock()
        {
            var requestSenderMock = new Mock <IHttpRequestSender>();

            requestSenderMock.Setup(s => s.PostAsync(It.IsAny <string>(), It.IsAny <HttpContent>()))
            .ReturnsAsync(new HttpResponseMessage(System.Net.HttpStatusCode.Created));

            IBankConfirmationBlockService service = new BankConfirmationBlockService(requestSenderMock.Object);

            return(service);
        }
コード例 #2
0
        private IBankConfirmationBlockService BuildConfirmationBlockGetMock()
        {
            var response = new HttpResponseMessage(System.Net.HttpStatusCode.OK);

            response.Content = new StringContent(JsonConvert.SerializeObject(CreateMockBankConfirmationBlock()), Encoding.UTF8, "application/json");
            var requestSenderMock = new Mock <IHttpRequestSender>();

            requestSenderMock
            .Setup(s => s.GetAsync(It.IsAny <string>()))
            .ReturnsAsync(response);
            IBankConfirmationBlockService service = new BankConfirmationBlockService(requestSenderMock.Object);

            return(service);
        }