コード例 #1
0
        public async Task GetDoorbotsHistory_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 mockHttpWebRequestDoorbotHistory = CreateMockHttpWebRequest(HttpStatusCode.NotModified, "A-OK", ExpectedDoorbotsHistoryResponseBytes);

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

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

            // Acquire Doorbot History
            var actualDoorbotsHistoryList = await comm.GetDoorbotsHistory();

            Assert.AreEqual(ExpectedDoorbotsHistoryList.Count, actualDoorbotsHistoryList.Count, "The DoorbotsHistoryList doesn't contain the same number of items as expected");

            // Compare all itesm within the ExpectedList and the actual
            var cnt = 0;

            foreach (var expected in ExpectedDoorbotsHistoryList)
            {
                ObjectCompare(expected, actualDoorbotsHistoryList[cnt]);
                cnt++;
            }
        }
コード例 #2
0
        public async Task GetDoorbotsHistoryTest()
        {
            var session = new RingCommunications(Username, Password);
            await session.Authenticate();

            var doorbotHistory = await session.GetDoorbotsHistory();

            Assert.IsTrue(doorbotHistory.Count > 0, "No doorbot history items returned");
        }
コード例 #3
0
        public async Task GetDoorbotsHistoryRecordingByInstanceTest()
        {
            var session = new RingCommunications(Username, Password);
            await session.Authenticate();

            var doorbotHistory = await session.GetDoorbotsHistory();

            Assert.IsTrue(doorbotHistory.Count > 0, "No doorbot history events were found");

            var tempFilePath = Path.GetTempFileName();

            await session.GetDoorbotHistoryRecording(doorbotHistory[0], tempFilePath);

            File.Delete(tempFilePath);
        }