Exemplo n.º 1
0
        public void CanGetAutoMobile()
        {
            // Arrange
            SetupEnvironment();

            // Act
            var savedCars = _manager.GetEntities(new ResourceCollectionParameters());

            // Assert
            Assert.True(_manager.ProcessResult.Success);
            Assert.NotNull(savedCars);
            var automobiles = savedCars.ToList();

            Assert.True(automobiles.Count == 1, "savedCars.Count == 1");
            var savedCar = automobiles.FirstOrDefault();

            Assert.NotNull(savedCar);
            Assert.Equal("AutoBack", savedCar.Brand);
            Assert.True(savedCar.Id >= 1, "savedCar.Id>=1");
        }
Exemplo n.º 2
0
        public void CanGetDiscounts()
        {
            //Arrange
            SetupEnvironment();

            // Act
            var savedDiscounts = _manager.GetEntities(new ResourceCollectionParameters()).ToList();

            // Assert
            Assert.True(_manager.ProcessResult.Success);
            Assert.NotNull(savedDiscounts);
            Assert.Equal(2, savedDiscounts.Count);
        }
Exemplo n.º 3
0
 public void CanAddGasLogHistory()
 {
     // Arrange
     const string comment  = "This is a test gas log";
     var          car      = _autoManager.GetEntityById(1);
     var          discount = _discountManager.GetEntities().FirstOrDefault();
     var          logDate  = new DateTime(2019, 12, 25);
     var          gasLog   = new GasLog
     {
         Date                = logDate,
         Car                 = car,
         Station             = "Costco",
         Gas                 = Volume.FromLiter(40),
         Price               = new Money(40.0),
         Distance            = Dimension.FromKilometer(300),
         CurrentMeterReading = Dimension.FromKilometer(12000),
         Discounts           = new List <GasDiscountInfo>
         {
             new()
             {
                 Amount  = new Money(0.8),
                 Program = discount
             }
         },