public void convertAPIToAPI() { apiCallback1 = CreateTypicalAPICallback(); apiCallback2 = new EventNotificationConfigConverter(apiCallback1).ToAPICallback(); Assert.IsNotNull(apiCallback2); Assert.AreEqual(apiCallback2, apiCallback1); }
internal Callback ToAPICallback() { Callback callback = new Callback(); callback.Url = url; foreach ( NotificationEvent notificationEvent in notificationEvents ) { callback.AddEvent(ToAPICallbackEvent(notificationEvent)); } return callback; }
public void convertSDKToAPI() { sdkEventNotificationConfig1 = CreateTypicalSDKEventNotificationConfig(); apiCallback1 = new EventNotificationConfigConverter(sdkEventNotificationConfig1).ToAPICallback(); Assert.IsNotNull(apiCallback1); Assert.AreEqual(apiCallback1.Url, sdkEventNotificationConfig1.Url); Assert.AreEqual(apiCallback1.Events.Count, 3); Assert.AreEqual(apiCallback1.Events[0].ToString(), sdkEventNotificationConfig1.NotificationEvents[0].ToString()); Assert.AreEqual(apiCallback1.Events[1].ToString(), sdkEventNotificationConfig1.NotificationEvents[1].ToString()); Assert.AreEqual(apiCallback1.Events[2].ToString(), sdkEventNotificationConfig1.NotificationEvents[2].ToString()); }
public void convertSDKToAPI() { sdkEventNotificationConfig1 = CreateTypicalSDKEventNotificationConfig(); apiCallback1 = new EventNotificationConfigConverter(sdkEventNotificationConfig1).ToAPICallback(); Assert.IsNotNull(apiCallback1); Assert.AreEqual(apiCallback1.Url, sdkEventNotificationConfig1.Url); Assert.AreEqual(apiCallback1.Events.Count, 3); Assert.AreEqual(apiCallback1.Events[0], sdkEventNotificationConfig1.NotificationEvents[0].getApiValue()); Assert.AreEqual(apiCallback1.Events[1], sdkEventNotificationConfig1.NotificationEvents[1].getApiValue()); Assert.AreEqual(apiCallback1.Events[2], sdkEventNotificationConfig1.NotificationEvents[2].getApiValue()); }
public void convertAPIToSDK() { apiCallback1 = CreateTypicalAPICallback(); sdkEventNotificationConfig1 = new EventNotificationConfigConverter(apiCallback1).ToSDKEventNotificationConfig(); Assert.IsNotNull(sdkEventNotificationConfig1); Assert.AreEqual(sdkEventNotificationConfig1.Url, apiCallback1.Url); Assert.AreEqual(sdkEventNotificationConfig1.NotificationEvents.Count, 3); Assert.AreEqual(sdkEventNotificationConfig1.NotificationEvents[0].getApiValue(), apiCallback1.Events[0]); Assert.AreEqual(sdkEventNotificationConfig1.NotificationEvents[1].getApiValue(), apiCallback1.Events[1]); Assert.AreEqual(sdkEventNotificationConfig1.NotificationEvents[2].getApiValue(), apiCallback1.Events[2]); }
public Silanis.ESL.API.Callback ToAPICallback() { if (sdkEventNotificationConfig == null) { return apiCallback; } Callback callback = new Callback(); callback.Url = sdkEventNotificationConfig.Url; foreach (NotificationEvent notificationEvent in sdkEventNotificationConfig.NotificationEvents) { callback.AddEvent(new EventNotificationConverter(notificationEvent).ToAPICallbackEvent()); } return callback; }
public void Register(Callback callback) { try { string path = template.UrlFor(UrlTemplate.CALLBACK_PATH).Build(); string json = JsonConvert.SerializeObject(callback, settings); restClient.Post(path, json); } catch (EslServerException e) { throw new EslServerException( "Unable to configure event notification. " + e.Message, e.ServerError, e); } catch (EslException e) { throw new EslException("Unable to configure event notification. " + e.Message, e); } }
public EventNotificationConfigConverter(Silanis.ESL.API.Callback apiCallback) { this.apiCallback = apiCallback; }
public void convertNullAPIToAPI() { apiCallback1 = null; converter = new EventNotificationConfigConverter(apiCallback1); Assert.IsNull(converter.ToAPICallback()); }
private Silanis.ESL.API.Callback CreateTypicalAPICallback() { Callback callback = new Callback(); callback.Url = "callback url"; callback.AddEvent(CallbackEvent.DOCUMENT_SIGNED); callback.AddEvent(CallbackEvent.PACKAGE_CREATE); callback.AddEvent(CallbackEvent.PACKAGE_TRASH); return callback; }