public void AprovarReservaComCarroDisponivelDeveAtribuirStatusReservado() { var carrosDao = new MockCarrosDaoComModeloDisponivel(); var reservasDao = new MockReservasDaoComSaveGet(); var gerenciador = new GerenciadorReservas(Substitute.For <ITransactionContextFactory>(), carrosDao, reservasDao, Substitute.For <IPessoasDao>()); var reserva = new EntityBuilder <IReservas>().Build(); reserva.Status = ReservasStatusListaItens.ItemAguardandoAprovacao; reserva.ModeloCarroHandle = new Handle(); reserva.DataInicio = DateTime.Now; reserva.DataFim = DateTime.Now.AddDays(3); gerenciador.AprovarReserva(reserva); var reservaRecuperada = reservasDao.Get(new Handle()); Assert.AreEqual(ReservasStatusListaItens.ItemReservado, reservaRecuperada.Status); }
public void AprovarReservaComCarroDisponivelDeveAtribuirStatusReservado() { // Arrange var carrosDao = CarrosDao.CreateInstance(); var reservasDao = new MockReservasDaoComSaveGet(); var gerenciador = new GerenciadorReservas(Substitute.For <ITransactionContextFactory>(), carrosDao, reservasDao, Substitute.For <IPessoasDao>()); IReservas reserva = Entidades.Reservas.Get(6); reserva.Status = ReservasStatusListaItens.ItemAguardandoAprovacao; reserva.ModeloCarroHandle = 10; // Na nossa base Fiat 147 reserva.DataInicio = DateTime.Now.AddMonths(6); reserva.DataFim = DateTime.Now.AddMonths(6).AddDays(5); // Act gerenciador.AprovarReserva(reserva); // Assert reserva = reservasDao.Get(reserva.Handle); Assert.AreEqual(ReservasStatusListaItens.ItemReservado, reserva.Status); Assert.AreEqual(10, reserva.CarroInstance.ModeloHandle); }