Exemple #1
0
        public void Add_region()
        {
            var region = session.Query <Region>().First(r => r.Id != supplier.HomeRegion.Id);

            session.Save(DataMother.CreateTestClientWithUser(region));
            Request.HttpMethod = "POST";
            controller.Params["edit.Region.Id"]   = region.Id.ToString();
            controller.Params["edit.PermitedBy"]  = "test";
            controller.Params["edit.RequestedBy"] = "test";
            controller.AddRegion(supplier.Id);

            Assert.AreEqual("Регион добавлен", Context.Flash["message"].ToString());
            var rules = session.Query <ReorderSchedule>().Where(s => s.RegionalData.Region == region).ToArray();

            Assert.That(rules.Count(), Is.GreaterThan(0));
            var intersections = session.Query <Intersection>().Count(i => i.Price == supplier.Prices[0] && i.Region == region);

            Assert.That(intersections, Is.GreaterThan(0));
        }