public void CanBuildAStatementForMultipleRegularRentals() { var movieTypeFactory = new MovieTypeFactory(); var movieTypeGateway = new InMemoryMovieTypeGateway(movieTypeFactory); var rentalGateway = new InMemoryRentalGateway(); var createRental = new CreateRental(movieTypeGateway, rentalGateway); createRental.Execute( new CreateRentalRequest { MovieName = "Batman Begins", Days = 1 } ); createRental.Execute( new CreateRentalRequest { MovieName = "The Dark Knight", Days = 2 } ); createRental.Execute( new CreateRentalRequest { MovieName = "The Dark Knight Rises", Days = 3 } ); var viewStatement = new ViewStatement(rentalGateway); var printStatement = new PrintStatement(viewStatement); var printStatementResponse = printStatement.Execute(); printStatementResponse.Statement.Should().Be( "Rental Record for Customer\n" + " Batman Begins 2.0\n" + " The Dark Knight 2.0\n" + " The Dark Knight Rises 3.5\n" + "You owe 7.5\n" + "You earned 3 frequent renter points" ); }
public void CanGetTheMovieTypeForAFilm() { var movieTypeGateway = new MovieTypeRetrieverSpy(); var rentalGateway = new InMemoryRentalGatewayDummy(); var createRental = new CreateRental(movieTypeGateway, rentalGateway); createRental.Execute(new CreateRentalRequest()); movieTypeGateway.IsRetrieveCalled.Should().BeTrue(); }
public void CanSaveARental() { var movieTypeGateway = new MovieTypeRetrieverDummy(); var rentalGateway = new InMemoryRentalGatewaySpy(); var createRental = new CreateRental(movieTypeGateway, rentalGateway); createRental.Execute(new CreateRentalRequest()); rentalGateway.IsSaveCalled.Should().BeTrue(); }
public void CanSaveARentalForRequestedMovieWithCost() { var movieTypeGateway = new MovieTypeRetrieverStub(); var rentalGateway = new InMemoryRentalGatewaySpy(); var createRental = new CreateRental(movieTypeGateway, rentalGateway); createRental.Execute( new CreateRentalRequest { MovieName = "Wonder Woman", Days = 1 } ); rentalGateway.SaveArguments[1].Should().Be(2.0); }
public void CanGetTheMovieTypeForRequestedFilm() { var movieTypeGateway = new MovieTypeRetrieverSpy(); var rentalGateway = new InMemoryRentalGatewayDummy(); var createRental = new CreateRental(movieTypeGateway, rentalGateway); const string movieName = "Man of Steel"; createRental.Execute( new CreateRentalRequest { MovieName = movieName } ); movieTypeGateway.RetrieveArguments[0].Should().Be(movieName); }
public void CanSaveARentalForRequestedMovie() { var movieTypeGateway = new MovieTypeRetrieverDummy(); var rentalGateway = new InMemoryRentalGatewaySpy(); var createRental = new CreateRental(movieTypeGateway, rentalGateway); const string movieName = "Batman V Superman: Dawn of Justice"; createRental.Execute( new CreateRentalRequest { MovieName = movieName } ); rentalGateway.SaveArguments[0].Should().Be(movieName); }
public void CanGetTheMovieTypeForRequestedNumberOfDays() { var movieTypeGateway = new MovieTypeRetrieverSpy(); var rentalGateway = new InMemoryRentalGatewayDummy(); var createRental = new CreateRental(movieTypeGateway, rentalGateway); const int days = 1; createRental.Execute( new CreateRentalRequest { Days = days } ); movieTypeGateway.RetrieveArguments[1].Should().Be(days); }