daily pastebin goal
44%
SHARE
TWEET

CarTypeSteps.cs

CryptoJones Aug 2nd, 2016 (edited) 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using NUnit.Framework;
  2. using TechTalk.SpecFlow;
  3.  
  4. namespace CarLot.Specs
  5. {
  6.     [Binding]
  7.     public class CarTypeSteps
  8.     {
  9.         Program carTypesProgram = new Program();
  10.  
  11.         [Given]
  12.         public void GivenIHaveALot()
  13.         {
  14.            
  15.             carTypesProgram.CarList.Clear();
  16.             Assert.IsEmpty(carTypesProgram.CarList);
  17.  
  18.         }
  19.         [When]
  20.         public void WhenICreateACarOfEachType()
  21.         {
  22.             carTypesProgram.CreateNewFunnyCar();
  23.             carTypesProgram.CreateNewPinto();
  24.             carTypesProgram.CreateNewSemiTruck();
  25.         }
  26.        
  27.         [Then]
  28.         public void ThenIShouldHaveThreeTypesOfCars()
  29.         {
  30.             bool haveAPinto = false;
  31.             bool haveAFunnyCar = false;
  32.             bool haveASemiTruck = false;
  33.  
  34.             foreach (Car car in carTypesProgram.CarList){
  35.                 if (car.carType == Program.CarType.Pinto)
  36.                 {
  37.                     haveAPinto = true;
  38.                 }
  39.                 if (car.carType == Program.CarType.FunnyCar)
  40.                 {
  41.                     haveAFunnyCar = true;
  42.                 }
  43.                 if (car.carType == Program.CarType.SemiTruck)
  44.                 {
  45.                     haveASemiTruck = true;
  46.                 }
  47.             }
  48.  
  49.             Assert.IsTrue(haveASemiTruck);
  50.             Assert.IsTrue(haveAPinto);
  51.             Assert.IsTrue(haveAFunnyCar);
  52.         }
  53.  
  54.  
  55.     }
  56. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top