Beispiel #1
0
        public void a_production_is_not_streamable_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.CanStream(c, p));
        }
Beispiel #2
0
        public void a_production_is_streamable_if_released()
        {
            var p = _productions.Insert(new { Title = "Test", Slug = "Test", Price = 12.00, Status = "released" });
            var c = _customers.Insert(new { Email = "*****@*****.**", First = "Test", Last = "User", StreamUntil = DateTime.Today.AddDays(2) });

            Assert.True(DigitalRights.CanStream(c, p));
        }
Beispiel #3
0
 public void monthly_order_should_bump_users_stream()
 {
     customer.StreamUntil = DateTime.Today.AddYears(-1);
     Assert.False(DigitalRights.CanStream(customer, production));
     MonthlyOrder();
     DigitalRights.AuthorizeOrder(customer, order);
     Assert.Greater(DateTime.Today.AddDays(25), customer.StreamUntil);
     Assert.True(DigitalRights.CanStream(customer, production));
 }
Beispiel #4
0
 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));
 }
Beispiel #5
0
 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));
 }
Beispiel #6
0
 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));
 }
Beispiel #7
0
 public void customer_can_download_and_stream_if_production_authorized()
 {
     AssignRights();
     Assert.True(DigitalRights.CanDownload(customer, production));
     Assert.True(DigitalRights.CanStream(customer, production));
 }
Beispiel #8
0
 public void customer_cannot_stream_if_stream_date_invalid()
 {
     customer.StreamUntil = DateTime.Today.AddDays(-30);
     Assert.False(DigitalRights.CanStream(customer, production));
 }