How-to: Testing License Time or Subscription Limits

In This Sample

During your testing and development of your licensing rules there will come a time when you will want to test the time aspect of your license. This could come from a Time Limit, subscription based Time Limit, or a Time Limit that defines the grace period of a Trial or Activation limit.

DeployLX detects and prevents attacks against clock modifications and rolling back the clock will result in a license validation exception. XHEO has incorporated a safe way to easily and quickly test the Time Limit. Below you will find code that demonstrates how to pass in a different time then the system clock time. You can easily change the time quickly between debug runs to see how the license responds. 

The test date cannot be set to a time earlier than the current system clock. It can only be used to test the behavior of the license "in the future".

Dim info = New LicenseValidationRequestInfo() With {_
  .TestDate = Date.UtcNow.AddDays(30)}

Dim license = SecureLicenseManager.Validate(Me, GetType(Form1), info)
var info = new LicenseValidationRequestInfo( )
    TestDate = DateTime.UtcNow.AddDays(30)

var license = SecureLicenseManager.Validate( this, typeof( Form1 ), info );
Published : Feb 11, 2009
Updated : Jan 04, 2012
Views : 7366

Applies To