Esempio n. 1
0
        public void WhenReserve_ThenReservesCar()
        {
            var fromUtc = DateTime.UtcNow.AddMinutes(1);
            var toUtc   = fromUtc.AddMinutes(1);
            var entity  = new CarEntity(this.recorder.Object, this.idFactory.Object);

            entity.SetManufacturer(new Manufacturer(2010, Manufacturer.Makes[0], Manufacturer.Models[0]));
            entity.SetOwnership(new VehicleOwner("anownerid"));
            entity.Register(new LicensePlate(LicensePlate.Jurisdictions[0], "anumber"));
            this.storage.Setup(s => s.Load(It.Is <Identifier>(i => i == "acarid")))
            .Returns(entity);
            this.storage.Setup(s => s.Save(It.Is <CarEntity>(e => e.Unavailabilities.Count == 1)))
            .Returns(entity);

            var result = this.carsApplication.Offline(this.caller.Object, "acarid", fromUtc, toUtc);

            result.Should().NotBeNull();
        }