public void testChecks()
{
// config with null app token
AdjustConfig nullAppTokenConfig = new AdjustConfig(null, AdjustConfig.EnvironmentSandbox);
Assert.Error("Missing App Token");
Assert.IsFalse(nullAppTokenConfig.IsValid());
// config with wrong size app token
AdjustConfig oversizeAppTokenConfig = new AdjustConfig("1234567890123", AdjustConfig.EnvironmentSandbox);
Assert.Error("Malformed App Token '1234567890123'");
Assert.IsFalse(oversizeAppTokenConfig.IsValid());
// config with null environment
AdjustConfig nullEnvironmentConfig = new AdjustConfig("123456789012", null);
Assert.Error("Missing environment");
Assert.IsFalse(nullEnvironmentConfig.IsValid());
// config with wrong environment
AdjustConfig wrongEnvironmentConfig = new AdjustConfig("123456789012", "Other");
Assert.Error("Unknown environment 'Other'");
Assert.IsFalse(wrongEnvironmentConfig.IsValid());
// start with null config
ActivityHandler nullConfigactivityHandler = ActivityHandler.GetInstance(null, DeviceUtil);
Assert.Error("AdjustConfig missing");
Assert.Null(nullConfigactivityHandler);
ActivityHandler invalidConfigactivityHandler = ActivityHandler.GetInstance(nullAppTokenConfig, DeviceUtil);
Assert.Error("AdjustConfig not initialized correctly");
Assert.Null(invalidConfigactivityHandler);
// event with null event token
AdjustEvent nullEventToken = new AdjustEvent(null);
Assert.Error("Missing Event Token");
Assert.IsFalse(nullEventToken.IsValid());
// event with wrong size
AdjustEvent wrongEventTokenSize = new AdjustEvent("eventXX");
Assert.Error("Malformed Event Token 'eventXX'");
Assert.IsFalse(wrongEventTokenSize.IsValid());
// event
AdjustEvent adjustEvent = new AdjustEvent("event1");
// event with negative revenue
adjustEvent.SetRevenue(-0.001, "EUR");
Assert.Error("Invalid amount -0.001");
// event with null currency
adjustEvent.SetRevenue(0, null);
Assert.Error("Currency must be set with revenue");
// event with empty currency
adjustEvent.SetRevenue(0, "");
Assert.Error("Currency is empty");
// callback parameter null key
adjustEvent.AddCallbackParameter(null, "callValue");
Assert.Error("Callback parameter key is missing");
// callback parameter empty key
adjustEvent.AddCallbackParameter("", "callValue");
Assert.Error("Callback parameter key is empty");
// callback parameter null value
adjustEvent.AddCallbackParameter("keyCall", null);
Assert.Error("Callback parameter value is missing");
// callback parameter empty value
adjustEvent.AddCallbackParameter("keyCall", "");
Assert.Error("Callback parameter value is empty");
// partner parameter null key
adjustEvent.AddPartnerParameter(null, "callValue");
Assert.Error("Partner parameter key is missing");
// partner parameter empty key
adjustEvent.AddPartnerParameter("", "callValue");
Assert.Error("Partner parameter key is empty");
// partner parameter null value
adjustEvent.AddPartnerParameter("keyCall", null);
Assert.Error("Partner parameter value is missing");
// partner parameter empty value
adjustEvent.AddPartnerParameter("keyCall", "");
Assert.Error("Partner parameter value is empty");
LogConfig.SetupLogging(logDelegate: msg => System.Diagnostics.Debug.WriteLine(msg),
logLevel: LogLevel.Warn);
// create the config to start the session
AdjustConfig config = new AdjustConfig("123456789012", AdjustConfig.EnvironmentSandbox);
// create handler and start the first session
ActivityHandler activityHandler = GetActivityHandler(config);
DeviceUtil.Sleep(3000);
// test init values
InitTests(AdjustConfig.EnvironmentSandbox, "Warn", false);
// test first session start
CheckFirstSession();
// track null event
activityHandler.TrackEvent(null);
DeviceUtil.Sleep(1000);
Assert.Error("Event missing");
activityHandler.TrackEvent(nullEventToken);
DeviceUtil.Sleep(1000);
Assert.Error("Event not initialized correctly");
}