public void TestCalculateBucketNoOrder() { int id = 1; DateTime?orderDate = null; DateTime cohortDate = DateTime.Now; string cohortIdentifier = "1/1-1/7"; int cohortPeriod = 0; ICustomerOrderDataPoint dataPoint = new CustomerOrderDataPoint(id, orderDate, cohortDate, cohortIdentifier, cohortPeriod); dataPoint = OrderBucketCalculator.CalculateBucket(dataPoint); Assert.AreEqual(0, dataPoint.CohortPeriod); }
public void TestCalculateBucketOrder14DaysAfterSignupInBucket3() { int id = 1; DateTime?orderDate = DateTime.Now.AddDays(14); DateTime cohortDate = DateTime.Now; string cohortIdentifier = "1/1-1/7"; int cohortPeriod = 0; ICustomerOrderDataPoint dataPoint = new CustomerOrderDataPoint(id, orderDate, cohortDate, cohortIdentifier, cohortPeriod); dataPoint = OrderBucketCalculator.CalculateBucket(dataPoint); Assert.AreEqual(3, dataPoint.CohortPeriod); }
public void TestCreateDataPoint() { int customerId = 1; DateTime orderDate = DateTime.Now; DateTime cohortDate = DateTime.Now; string cohortIdentifier = "20150101"; int cohortPeriod = 1; ICustomerOrderDataPoint dataPoint = new CustomerOrderDataPoint( customerId, orderDate, cohortDate, cohortIdentifier, cohortPeriod); Assert.AreEqual(customerId, dataPoint.Id); Assert.AreEqual(orderDate, dataPoint.OrderDate); Assert.AreEqual(cohortDate, dataPoint.CohortDate); Assert.AreEqual(cohortIdentifier, dataPoint.CohortIdentifier); Assert.AreEqual(cohortPeriod, dataPoint.CohortPeriod); }