Ejemplo n.º 1
0
        public void AmazonAnalyticsService_GetAverageOrderAmount_ShouldReturnAvgAmount()
        {
            var items = Enumerable.Range(0, 10).Select(i => new AmazonOrder()
            {
                OrderTotalAmount       = Decimal.Parse("0.5"),
                NumberOfItemsShipped   = 1,
                NumberOfItemsUnshipped = 0,
                PurchaseDate           = CurrentRequestData.Now.Date.AddDays(i),
                CreatedOn = CurrentRequestData.Now.Date.AddDays(i),
                Site      = CurrentRequestData.CurrentSite
            }).ToList();

            Session.Transact(session => items.ForEach(item => session.Save(item)));

            var results = _amazonAnalyticsService.GetAverageOrderAmount(CurrentRequestData.Now.Date.AddDays(-20),
                                                                        CurrentRequestData.Now.Date.AddDays(20));

            results.Should().Be(Double.Parse("0.5"));
        }