public void ReturnsDaysSubscribedToDate() { var member = MemberHelpers.CreateWithDefaultConstructor(); MemberSubscription subscription = SubscriptionHelpers.GetSubscriptionWithGivenSubscribedDaysToDateAndTotalSubscribedDays(50); member.AddSubscription(subscription.Dates, 1); int days = member.TotalSubscribedDays(); Assert.Equal(50, days); }
public void Returns100GivenPercentageOver100() { var member = MemberHelpers.CreateWithDefaultConstructor(); var subscription = SubscriptionHelpers.GetSubscriptionWithGivenSubscribedDaysToDateAndTotalSubscribedDays(731); member.AddSubscription(subscription.Dates); var expectedPercentage = 100; var percentage = _memberSubscriptionPeriodCalculationsService.GetPercentageProgressToAlumniStatus(member); Assert.Equal(expectedPercentage, percentage); }
public void CalculatesCorrectPercentageGivenPercentageBelow100(int days) { var member = MemberHelpers.CreateWithDefaultConstructor(); var subscription = SubscriptionHelpers.GetSubscriptionWithGivenSubscribedDaysToDateAndTotalSubscribedDays(days); member.AddSubscription(subscription.Dates); var expectedPercentage = (int)(100 * ((double)days / (double)730)); var percentage = _memberSubscriptionPeriodCalculationsService.GetPercentageProgressToAlumniStatus(member); Assert.Equal(expectedPercentage, percentage); }