Esempio n. 1
0
        public async void TestWarningRuleIsNotApplied()
        {
            var rules = new RulesServiceClient(BaseUrl, SessionId, new DummyPackageInfo(), null);

            CreateDefaultRules(rules);
            var rule = rules.GetRules().Single(r => r.Category == RuleCategory.WarningRule && r.Type == RuleType.Default);

            rules.DeactivateRule(rule.Id);

            var sut   = new OrderServiceClient(BaseUrl, SessionId, new DummyPackageInfo(), null, null);
            var order = new CreateOrderRequest
            {
                Id             = Guid.NewGuid(),
                PickupAddress  = TestAddresses.GetAddress1(),
                PickupDate     = DateTime.Now,
                DropOffAddress = TestAddresses.GetAddress2(),
                Settings       = new BookingSettings
                {
                    ChargeTypeId  = ChargeTypes.PaymentInCar.Id,
                    VehicleTypeId = 1,
                    ProviderId    = 13,
                    Phone         = "5145551212",
                    Passengers    = 6,
                    NumberOfTaxi  = 1,
                    Name          = "Joe Smith"
                },
            };

            var validation = await sut.ValidateOrder(order);

            Assert.IsFalse(validation.HasWarning);
            Assert.IsNullOrEmpty(validation.Message);
        }
Esempio n. 2
0
        public void ActivateDeactivate()
        {
            var sut = new RulesServiceClient(BaseUrl, SessionId, new DummyPackageInfo(), null);

            sut.ActivateRule(_knownRuleId);

            var rule = sut.GetRules().Single(x => x.Id == _knownRuleId);

            Assert.IsTrue(rule.IsActive);

            sut.DeactivateRule(_knownRuleId);
            rule = sut.GetRules().Single(x => x.Id == _knownRuleId);
            Assert.IsFalse(rule.IsActive);

            sut.ActivateRule(_knownRuleId);
            rule = sut.GetRules().Single(x => x.Id == _knownRuleId);
            Assert.IsTrue(rule.IsActive);
        }