public void AuthorizeDevice_throws_on_non_zero_status()
 {
     Remote.AuthorizeDevice(Username,
                            Token,
                            DeviceId,
                            DeviceName,
                            Timestamp,
                            SetupClientForPostWithAuth(ResponseWithError).Object);
 }
 public void AuthorizeDevice_throws_on_incorrect_xml()
 {
     TestOnIncorrectXml(client => Remote.AuthorizeDevice(Username,
                                                         Token,
                                                         DeviceId,
                                                         DeviceName,
                                                         Timestamp,
                                                         client),
                        SetupClientForPostWithAuth);
 }
 public void AuthorizeDevice_throws_on_network_error()
 {
     TestThrowsNetworkError(client => Remote.AuthorizeDevice(Username,
                                                             Token,
                                                             DeviceId,
                                                             DeviceName,
                                                             Timestamp,
                                                             client),
                            SetupClientForPostWithAuthError);
 }
        public void AuthorizeDevice_makes_post_request()
        {
            var client = SetupClientForPostWithAuth(AuthorizeDeviceResponse);

            Remote.AuthorizeDevice(Username, Token, DeviceId, DeviceName, Timestamp, client.Object);

            client.Verify(x => x.Post(It.Is <string>(s => s == "DevAuth"),
                                      It.Is <string>(s => s.Contains(DeviceId)),
                                      It.Is <string>(s => s.StartsWith("Basic ")),
                                      It.Is <DateTime>(d => d == Timestamp),
                                      It.Is <Dictionary <string, string> >(
                                          d => d.ContainsKey("hid") && d["hid"] == DeviceName)));
        }