Exemplo n.º 1
0
 public void givenDistanceAndTime_WhenPassingIntegerArragment_ShouldThrowException()
 {
     try
     {
         cabInVoiceGenerator invoiceGenerator = new cabInVoiceGenerator();
         double fare = invoiceGenerator.CalculateFare(0.0, 0);
     }
     catch (CabInvoiceAnalyserException e)
     {
         Assert.AreEqual(CabInvoiceAnalyserException.ExceptionType.INVALID_ARGUMENT_EXCEPTION, e.type);
     }
 }
Exemplo n.º 2
0
 public void givenMultipleDistanceAndTime_whenPassingNullArgument_shouldReturnAggregateFare()
 {
     try
     {
         cabInVoiceGenerator invoiceGenerator = new cabInVoiceGenerator();
         Ride[] rides = null;
         double fare  = invoiceGenerator.CalculateMultipleFare(rides);
     }
     catch (CabInvoiceAnalyserException e)
     {
         Assert.AreEqual(CabInvoiceAnalyserException.ExceptionType.NULL_REFERENCE_EXCEPTION, e.type);
     }
 }
Exemplo n.º 3
0
 public void givenDistanceAndTime_WhenPassingArragment_ShouldReturnTotalFare()
 {
     try
     {
         cabInVoiceGenerator invoiceGenerator = new cabInVoiceGenerator();
         double distance = 2.0;
         int    time     = 5;
         double fare     = invoiceGenerator.CalculateFare(distance, time);
         Assert.AreEqual(25, fare);
     }catch (CabInvoiceAnalyserException e)
     {
         Assert.AreEqual(CabInvoiceAnalyserException.ExceptionType.INVALID_ARGUMENT_EXCEPTION, e.type);
     }
 }
Exemplo n.º 4
0
 public void GivenMultipleRides_WhenPassingWrongArgument_ShouldReturnInvoiceSummary()
 {
     try
     {
         cabInVoiceGenerator invoiceGenerator = new cabInVoiceGenerator();
         Ride[]         rides = { new Ride(0, 0),
                                  new Ride(0, 0) };
         InvoiceSummary summary = invoiceGenerator.CalculateMultipleFareUsingSummery(rides);
     }
     catch (CabInvoiceAnalyserException e)
     {
         Assert.AreEqual(CabInvoiceAnalyserException.ExceptionType.INVALID_ARGUMENT_EXCEPTION, e.type);
     }
 }
Exemplo n.º 5
0
 public void givenMultipleDistanceAndTime_whenPassingArgument_shouldReturnAggregateFare()
 {
     try
     {
         cabInVoiceGenerator invoiceGenerator = new cabInVoiceGenerator();
         Ride[] rides = { new Ride(2.0, 5),
                          new Ride(0.1, 1) };
         double fare = invoiceGenerator.CalculateMultipleFare(rides);
         Assert.AreEqual(30, fare);
     }
     catch (CabInvoiceAnalyserException e)
     {
         Assert.AreEqual(CabInvoiceAnalyserException.ExceptionType.INVALID_ARGUMENT_EXCEPTION, e.type);
     }
 }
Exemplo n.º 6
0
 public void givenLessDistanceAndTime_whenPassingArgument_shouldReturnMinimumFare()
 {
     try
     {
         cabInVoiceGenerator invoiceGenerator = new cabInVoiceGenerator();
         double distance = 0.1;
         int    time     = 1;
         double fare     = invoiceGenerator.CalculateFare(distance, time);
         Assert.AreEqual(5, fare);
     }
     catch (CabInvoiceAnalyserException e)
     {
         Assert.AreEqual(CabInvoiceAnalyserException.ExceptionType.INVALID_ARGUMENT_EXCEPTION, e.type);
     }
 }