public void UpdateRequestStatusTest()
 {
     IAccountProvider accountProvider = AccountProviderFactory.GetAccountProvider();
     var target = new RequestProvider(accountProvider);
     string errorMessage = string.Empty;
     SaveProcessedRequestTest();
     bool isSuccess = target.UpdateRequestStatus(request.RequestId, RequestStatus.Rejected.ToString(),
                                                 out errorMessage);
     Assert.IsTrue(isSuccess && string.IsNullOrEmpty(errorMessage), "Failed to update processed request status");
 }
 public void UpdateRequestTest()
 {
     IAccountProvider accountProvider = AccountProviderFactory.GetAccountProvider();
     var target = new RequestProvider(accountProvider);
     string errorMessage = string.Empty;
     string errorMessageExpected = string.Empty;
     Request actual;
     request.TravelDate = request.TravelDate.AddDays(10);
     actual = target.UpdateRequest(request, out errorMessage);
     Assert.AreEqual(errorMessageExpected, errorMessage);
     Assert.IsNotNull(actual);
 }
 public void RequestProviderConstructorTest()
 {
     IAccountProvider accountProvider = AccountProviderFactory.GetAccountProvider();
     var target = new RequestProvider(accountProvider);
 }
 public void SaveProcessedRequestTest()
 {
     IAccountProvider accountProvider = AccountProviderFactory.GetAccountProvider();
     var target = new RequestProvider(accountProvider);
     string errorMessage = string.Empty;
     FlightRequest processedRequest = new FlightRequest()
                                          {
                                              RequestId = request.RequestId,
                                              AirlineBidAmount = 3000,
                                              FlightNumber = "A324",
                                              Status = RequestStatus.Accepted,
                                              PaxCount = 1,
                                              RequesterBidAmount = request.BidAmount,
                                          };
     bool isSuccess = target.SaveProcessedRequest(processedRequest, out errorMessage);
     Assert.IsTrue(isSuccess && string.IsNullOrEmpty(errorMessage), "Failed to save processed request");
 }
 public void IsRequestValidTest()
 {
     IAccountProvider accountProvider = AccountProviderFactory.GetAccountProvider();
     var target = new RequestProvider(accountProvider);
     bool expected = false;
     bool actual;
     actual = target.IsRequestValid(request.RequestId);
     Assert.AreEqual(expected, actual);
 }
 public void GetRequestTest()
 {
     IAccountProvider accountProvider = AccountProviderFactory.GetAccountProvider();
     var target = new RequestProvider(accountProvider);
     Request actual;
     actual = target.GetRequest(accountId, request.RequestId);
     Assert.IsNotNull(actual);
 }
 public void GetRequestsByAccountIdTest()
 {
     IAccountProvider accountProvider = AccountProviderFactory.GetAccountProvider();
     var target = new RequestProvider(accountProvider);
     List<Request> actual;
     actual = target.GetRequestsByAccountId(accountId);
     Assert.IsNotNull(actual);
 }
 public void GetProcessedFlightRequestsTest()
 {
     IAccountProvider accountProvider = AccountProviderFactory.GetAccountProvider();
     var target = new RequestProvider(accountProvider);
     var result = target.GetFlightRequests("Processed");
     Assert.IsTrue(result != null, "GetFlightRequests returned null response");
 }
        public void AddRequestTest()
        {
            if (string.IsNullOrEmpty(request.RequestId))
            {
                IAccountProvider accountProvider = AccountProviderFactory.GetAccountProvider();
                var target = new RequestProvider(accountProvider);

                string errorMessage = string.Empty;
                string errorMessageExpected = string.Empty;
                Request expected = null;
                Request actual;
                actual = target.AddRequest(request, out errorMessage);
                Assert.AreEqual(errorMessageExpected, errorMessage, errorMessage);
                Assert.IsNotNull(actual);
                request = actual;
            }
        }