Exemple #1
0
        protected void AssertOrderPage(Guid employerId, IList <Product> products, IList <OrderAdjustment> adjustments)
        {
            var order = _ordersQuery.GetOrders(employerId)[0];

            Get(GetOrderUrl(order.Id));

            AssertAdjustments(Browser.CurrentHtml.DocumentNode, products, adjustments);
        }
        private Order AssertOrder(Guid employerId, JobAdFeaturePack featurePack)
        {
            var orders = _ordersQuery.GetOrders(employerId);

            Assert.AreEqual(1, orders.Count);
            var order = orders[0];

            Assert.AreEqual(featurePack == JobAdFeaturePack.FeaturePack1 ? 10m : 20m, order.Price);
            Assert.AreEqual(featurePack == JobAdFeaturePack.FeaturePack1 ? 11m : 22m, order.AdjustedPrice);
            Assert.AreEqual(employerId, order.OwnerId);
            Assert.AreEqual(employerId, order.PurchaserId);

            Assert.AreEqual(1, order.Adjustments.Count);
            var adjustment = order.Adjustments[0];

            Assert.AreEqual(featurePack == JobAdFeaturePack.FeaturePack1 ? 11m : 22m, adjustment.AdjustedPrice);
            Assert.AreEqual(featurePack == JobAdFeaturePack.FeaturePack1 ? 10m : 20m, adjustment.InitialPrice);

            Assert.AreEqual(1, order.Items.Count);
            var item = order.Items[0];

            Assert.AreEqual(featurePack == JobAdFeaturePack.FeaturePack1 ? 10m : 20m, item.Price);

            var product = _employerOrdersQuery.GetJobAdFeaturePackProduct(featurePack);

            Assert.AreEqual(product.Id, item.ProductId);

            return(order);
        }
Exemple #3
0
        private void AssertOrder(Guid employerId, Guid productId)
        {
            var orders = _ordersQuery.GetOrders(employerId);

            Assert.AreEqual(1, orders.Count);
            var order = orders[0];

            Assert.AreEqual(1, order.Items.Count);
            var item = order.Items[0];

            Assert.AreEqual(productId, item.ProductId);
        }
Exemple #4
0
        public ActionResult Index(Guid id)
        {
            var employer = _employersQuery.GetEmployer(id);

            if (employer == null)
            {
                return(NotFound("employer", "id", id));
            }

            var credits = _creditsQuery.GetCredits();

            return(View(new EmployerCreditsModel
            {
                Employer = employer,
                Allocations = new Dictionary <Guid, IList <Allocation> > {
                    { employer.Id, GetAllocations(employer.Id) }
                },
                Credits = credits,
                CreditId = _creditsQuery.GetCredit <ContactCredit>().Id,
                Orders = _ordersQuery.GetOrders(employer.Id)
            }));
        }
Exemple #5
0
        protected void AssertOrders(Guid ownerId, Coupon coupon, Discount discount, params Product[] products)
        {
            var orders = _ordersQuery.GetOrders(ownerId);

            Assert.AreEqual(1, orders.Count);
            var order = orders[0];

            AssertOrder(order, coupon, discount, products);

            // Use the id and code.

            order = _ordersQuery.GetOrder(order.Id);
            AssertOrder(order, coupon, discount, products);
            order = _ordersQuery.GetOrder(order.ConfirmationCode);
            AssertOrder(order, coupon, discount, products);
        }
Exemple #6
0
        public ActionResult Credits()
        {
            var employerId = User.Id().Value;

            var credits = _creditsQuery.GetCredits();

            var hierarchy   = _recruitersQuery.GetOrganisationHierarchyPath(employerId);
            var allocations = _allocationsQuery.GetAllocationsByOwnerId(hierarchy);

            var orders = _ordersQuery.GetOrders(from a in allocations.SelectMany(b => b.Value) where a.ReferenceId != null select a.ReferenceId.Value);

            return(View(new EmployerCreditsModel
            {
                Employer = CurrentEmployer,
                OrganisationHierarchy = _organisationsQuery.GetOrganisations(hierarchy.Skip(1)),
                Credits = credits,
                Allocations = allocations.ToDictionary(a => a.Key, a => (IList <Allocation>)a.Value),
                Orders = orders
            }));
        }
Exemple #7
0
        public ActionResult Index(Guid id)
        {
            var organisation = _organisationsQuery.GetOrganisation(id);

            if (organisation == null)
            {
                return(NotFound("organisation", "id", id));
            }

            var credits = _creditsQuery.GetCredits();

            return(View(new OrganisationCreditsModel
            {
                Organisation = organisation,
                Allocations = new Dictionary <Guid, IList <Allocation> > {
                    { organisation.Id, GetAllocations(organisation.Id) }
                },
                Credits = credits,
                CreditId = credits[0].Id,
                Orders = _ordersQuery.GetOrders(organisation.Id)
            }));
        }
 public ActionResult Index()
 {
     return(View(_ordersService.GetOrders(LoginUserInfo.UserId)));
 }