public void SendHeartbeat_WhenHeartbeatNameContainsIlligalCharacters_VerifyUrlEncodedCreate() { settings.HeartbeatName = "dummy&heartbeat%withillegal#chars"; sut = new OpsGenieApiClient(httpHandler.Object, settings); httpHandler .Setup(_ => _.CreateRequest(It.IsAny <string>())) .Returns((string url) => (HttpWebRequest)WebRequest.Create(url)); sut.SendHeartbeat(); httpHandler.Verify(_ => _.CreateRequest("https://api.opsgenie.com/v2/heartbeats/dummy%26heartbeat%25withillegal%23chars/ping"), Times.Once); }
public void Setup() { httpHandler = new Mock <IHttpRequestHandler>(); settings = new OpsGenieSettings { Threshold = NotificationLevel.Error, HeartbeatName = "dummy-heartbeat", TeamName = "dummy-team", ApiKey = "dummy-api-key", }; sut = new OpsGenieApiClient(httpHandler.Object, settings); }