Example #1
0
        public void Given()
        {
            const string username = "******";
            const string password = "******";

            _optOutId         = Guid.NewGuid();
            _accountReference = "EX0123456";
            _receivedAt       = DateTime.UtcNow;
            _phoneNumber      = "44123456789";

            var data = new
            {
                OptOut = new
                {
                    Id               = _optOutId,
                    ReceivedAt       = _receivedAt,
                    AccountReference = _accountReference,
                    From             = new
                    {
                        PhoneNumber = _phoneNumber
                    }
                }
            };

            MockApi.SetEndpoint(new MockEndpoint(200, JsonConvert.SerializeObject(data), "application/json; charset=utf-8"));

            var optOutClient = new OptOutsService(MockApi.Url, new EsendexCredentials(username, password));

            _result  = optOutClient.Add(_accountReference, _phoneNumber);
            _request = MockApi.LastRequest;
        }
Example #2
0
        public void Given()
        {
            const string username = "******";
            const string password = "******";

            var data = new
            {
                Errors = new[]
                {
                    new
                    {
                        Code        = _code,
                        Description = _description
                    }
                }
            };

            MockApi.SetEndpoint(new MockEndpoint(400, JsonConvert.SerializeObject(data), "application/json"));

            var optOutClient = new OptOutsService(MockApi.Url, new EsendexCredentials(username, password));

            _result = optOutClient.Add("", "");
        }