public void a_production_is_downloadable_if_released_and_user_eligible() { var p = _productions.Insert(new { Title = "Test", Slug = "Test", Price = 12.00, Status = "released" }); var c = _customers.Insert(new { Email = "*****@*****.**", First = "Test", Last = "User", DownloadUntil = DateTime.Today.AddDays(1) }); Assert.True(DigitalRights.CanDownload(c, p)); }
public void a_production_is_not_downloadable_if_not_released() { var p = _productions.Insert(new { Title = "Test", Slug = "Test", Price = 12.00 }); var c = _customers.Insert(new { Email = "*****@*****.**", First = "Test", Last = "User" }); Assert.IsFalse(DigitalRights.CanDownload(c, p)); }
public void customer_cant_download_and_stream_if_production_revoked() { AssignRights(); Assert.True(DigitalRights.CanDownload(customer, production)); Assert.True(DigitalRights.CanStream(customer, production)); DigitalRights.Revoke(customer, production); Assert.False(DigitalRights.CanDownload(customer, production)); Assert.False(DigitalRights.CanStream(customer, production)); }
public void production_order_should_allow_access_forever() { //reset Massive.DB.Current.Execute("DELETE FROM Customers_Productions"); Assert.False(DigitalRights.CanDownload(customer, production)); Assert.False(DigitalRights.CanStream(customer, production)); ProductOrder(); DigitalRights.AuthorizeOrder(customer, order); Assert.True(DigitalRights.CanDownload(customer, production)); Assert.True(DigitalRights.CanStream(customer, production)); }
public void yearly_order_should_bump_users_stream() { //reset customer.StreamUntil = DateTime.Today.AddYears(-2); customer.DownloadUntil = DateTime.Today.AddYears(-2); Assert.False(DigitalRights.CanDownload(customer, production)); Assert.False(DigitalRights.CanStream(customer, production)); AnnualOrder(); DigitalRights.AuthorizeOrder(customer, order); Assert.Greater(DateTime.Today.AddMonths(11), customer.StreamUntil); Assert.Greater(DateTime.Today.AddMonths(11), customer.DownloadUntil); Assert.True(DigitalRights.CanDownload(customer, production)); Assert.True(DigitalRights.CanStream(customer, production)); }
public void customer_can_download_and_stream_if_production_authorized() { AssignRights(); Assert.True(DigitalRights.CanDownload(customer, production)); Assert.True(DigitalRights.CanStream(customer, production)); }
public void customer_cannot_download_if_stream_date_invalid() { customer.DownloadUntil = DateTime.Today.AddDays(-30); Assert.False(DigitalRights.CanDownload(customer, production)); }