public void LicensedDispatcher_ValidLicense_Module1() { //Expects all classes to be handled int expextedResult = 2 * 3 * 5; TestLicenseContent licenseContent = new TestLicenseContent(); licenseContent.SetValidity(true); licenseContent.Modules = new List <string> { "Module1" }; var va = Helpers.InitializeLicensedTestVA(new Configuration(), licenseContent); var env = va.CreateEventHandlerEnvironment(MFilesAPI.MFEventHandlerType.MFEventHandlerBeforeLoginToVault); TestLicenseCommand command = new TestLicenseCommand(env) { Result = 1 }; Dispatcher dispatcher = va.EventDispatcher; dispatcher.Dispatch(command); Assert.AreEqual(expextedResult, command.Result); }
public void LicensedDispatcher_InvalidLicense() { //Expects only the unlicensed class to be handled int expextedResult = 2; //3, 5 and 7 are not handled TestLicenseContent licenseContent = new TestLicenseContent(); licenseContent.SetValidity(false); var va = Helpers.InitializeLicensedTestVA(new Configuration(), licenseContent); var env = va.CreateEventHandlerEnvironment(MFilesAPI.MFEventHandlerType.MFEventHandlerBeforeLoginToVault); TestLicenseCommand command = new TestLicenseCommand(env) { Result = 1 }; Dispatcher dispatcher = va.EventDispatcher; dispatcher.Dispatch(command); Assert.AreEqual(expextedResult, command.Result); }