Example #1
0
        public async Task Then_Calls_Api_Client_With_Correct_Request(
            Guid id,
            long accountId,
            long accountLegalEntityId,
            long transferSenderAccountId,
            Guid userId,
            [Frozen] Mock <IApiClient> mockApiClient,
            ReservationService service)
        {
            //Arrange
            mockApiClient.Setup(x => x.Create <CreateReservationResponse>(It.IsAny <ReservationApiRequest>()))
            .ReturnsAsync(new CreateReservationResponse()
            {
                Id = id
            });
            //Act
            await service.CreateReservationLevyEmployer(id, accountId, accountLegalEntityId, transferSenderAccountId, userId);

            //Assert
            mockApiClient.Verify(x => x.Create <CreateReservationResponse>(It.Is <ReservationApiRequest>(
                                                                               request => request.Id == id &&
                                                                               request.AccountId == accountId &&
                                                                               request.AccountLegalEntityId == accountLegalEntityId &&
                                                                               request.TransferSenderAccountId == transferSenderAccountId &&
                                                                               request.UserId == userId &&
                                                                               request.IsLevyAccount)));
        }
        public async Task AndCreatingALevyReservation_ThenCallsApiClientWithCorrectRequest(
            Guid id,
            long accountId,
            uint providerId,
            DateTime startDate,
            long accountLegalEntityId,
            string accountLegalEntityName,
            long?transferSenderAccountId,
            Guid?userId,
            [Frozen] Mock <IApiClient> mockApiClient,
            ReservationService service)
        {
            //Arrange
            mockApiClient.Setup(x => x.Create <CreateReservationResponse>(It.IsAny <ReservationApiRequest>()))
            .ReturnsAsync(new CreateReservationResponse()
            {
                Id = id
            });
            //Act
            await service.CreateReservationLevyEmployer(id, accountId, accountLegalEntityId, transferSenderAccountId, userId);

            //Assert
            mockApiClient.Verify(x => x.Create <CreateReservationResponse>(It.Is <ReservationApiRequest>(
                                                                               request => request.Id == id &&
                                                                               request.AccountId == accountId &&
                                                                               request.AccountLegalEntityId == accountLegalEntityId &&
                                                                               request.TransferSenderAccountId == transferSenderAccountId &&
                                                                               request.UserId == userId &&
                                                                               request.IsLevyAccount)));
        }
Example #3
0
        public async Task Then_Returns_Correct_Response(
            Guid id,
            long accountId,
            long accountLegalEntityId,
            Guid userId,
            [Frozen] Mock <IApiClient> mockApiClient,
            ReservationService service)
        {
            //Arrange
            mockApiClient.Setup(x => x.Create <CreateReservationResponse>(It.IsAny <ReservationApiRequest>()))
            .ReturnsAsync(new CreateReservationResponse()
            {
                Id = id
            });
            //Act
            var result = await service.CreateReservationLevyEmployer(id, accountId, accountLegalEntityId, null, userId);

            //Assert
            Assert.AreEqual(id, result.Id);
        }