コード例 #1
0
        public async Task GetDevicesTest()
        {
            var session = new RingCommunications(Username, Password);
            await session.Authenticate();

            var devices = await session.GetRingDevices();

            Assert.IsTrue(devices.Chimes.Count > 0 && devices.Doorbots.Count > 0, "No doorbots and/or chimes returned");
        }
コード例 #2
0
        public async Task GetRingDevices_Verify()
        {
            // ARRANGE

            // Mock the HttpWebRequest and HttpWebResponse (which is within the request)- AUTH
            var mockHttpWebRequestAuth = CreateMockHttpWebRequest(HttpStatusCode.NotModified, "A-OK", ExpectedAuthenticationResponseBytes);

            // Mock the HttpWebRequest and HttpWebResponse (which is within the request)- Devices
            var mockHttpWebRequestDevices = CreateMockHttpWebRequest(HttpStatusCode.NotModified, "A-OK", ExpectedDevicesResponseBytes);

            // ACT
            var comm = new RingCommunications(Username, Password)
            {
                AuthRequest    = mockHttpWebRequestAuth,
                DevicesRequest = mockHttpWebRequestDevices
            };

            // Authenticate
            var actualSessionAuthObject = await comm.Authenticate();

            var actualDevices = await comm.GetRingDevices();

            Assert.IsTrue(actualDevices.Chimes.Count > 0 && actualDevices.Doorbots.Count > 0, "No doorbots and/or chimes returned");
        }
コード例 #3
0
 public async Task GetDevicesUnauthenticatedTest()
 {
     var session = new RingCommunications(Username, Password);
     await session.GetRingDevices();
 }