public void Given() { const string username = "******"; const string password = "******"; _optOutId = Guid.NewGuid(); _receivedAt = DateTime.UtcNow; _accountReference = "EX0123456"; _phoneNumber = "44123456789"; var data = new { Id = _optOutId, ReceivedAt = _receivedAt, AccountReference = _accountReference, From = new { PhoneNumber = _phoneNumber } }; MockApi.SetEndpoint(new MockEndpoint(200, JsonConvert.SerializeObject(data), "application/json")); var optOutClient = new OptOutsService(MockApi.Url, new EsendexCredentials(username, password)); _result = optOutClient.GetById(_optOutId); _request = MockApi.LastRequest; }
public void Given() { const string username = "******"; const string password = "******"; var optOutId = Guid.NewGuid(); MockApi.SetEndpoint(new MockEndpoint(_statusCode)); var optOutClient = new OptOutsService(MockApi.Url, new EsendexCredentials(username, password)); try { optOutClient.GetById(optOutId); } catch (WebException ex) { _result = ex; } }