コード例 #1
0
 public Processing_Failed_At_Bank(TestFixture fixture) : base(fixture)
 {
     _request                = RequestGenerator.Generate();
     _request.MerchantId     = "FailMerchant";
     _httpResponseMessage    = HttpClient.PostAsJsonAsync("/payments", _request).Result;
     _processPaymentResponse = DeserializeJson <ProcessPaymentResponse>(_httpResponseMessage.Content.ReadAsStringAsync().Result);
 }
コード例 #2
0
ファイル: Tests.cs プロジェクト: takubokudori/PowerComposer
        private void GenerateTestUnit(ref RequestGenerator prg, bool expectedHasNext, string[] expectedReturn = null)
        {
            bool hasNext = prg.HasNext();

            if (!expectedHasNext)
            {
                Assert.False(hasNext);
                return;
            }

            Assert.True(hasNext);
            Assert.AreEqual(expectedReturn, prg.Generate());
        }
コード例 #3
0
        public async Task Process_Returns_Created_When_Request_Succeeds()
        {
            // Arrange
            var request = RequestGenerator.Generate();

            Mocker.GetMock <IPaymentRepository>()
            .Setup(x => x.UpsertAsync(It.IsAny <Payment>()))
            .ReturnsAsync((Payment p) => p)
            .Verifiable();

            // Act
            var actual = await SUT.PostAsJsonAsync("/payments", request);

            // Assert
            Mocker.VerifyAll();
            actual.StatusCode.Should().Be(HttpStatusCode.Accepted);
        }
コード例 #4
0
        public async Task Process_Returns_InternalServerError_When_Bank_Returns_Invalid_Status()
        {
            // Arrange
            var request = RequestGenerator.Generate();

            request.MerchantId = "EdgeCaseMerchant";

            Mocker.GetMock <IPaymentRepository>()
            .Setup(x => x.UpsertAsync(It.IsAny <Payment>()))
            .ReturnsAsync((Payment p) => p)
            .Verifiable();

            // Act
            var actual = await SUT.PostAsJsonAsync("/payments", request);

            // Assert
            Mocker.VerifyAll();
            actual.StatusCode.Should().Be(HttpStatusCode.InternalServerError);
        }
コード例 #5
0
ファイル: Processing_Succeeded.cs プロジェクト: cainux/cko
 public Processing_Succeeded(TestFixture fixture) : base(fixture)
 {
     _request                = RequestGenerator.Generate();
     _httpResponseMessage    = HttpClient.PostAsJsonAsync("/payments", _request).Result;
     _processPaymentResponse = DeserializeJson <ProcessPaymentResponse>(_httpResponseMessage.Content.ReadAsStringAsync().Result);
 }