public void CameraRespondValidTest(string ip, int numRecords) { var blackVueDownloader = new PCL.BlackVueDownloader(); using (var httpTest = new HttpTest()) { httpTest.RespondWith(GenerateRecords(numRecords)); var body = blackVueDownloader.QueryCameraForFileList(ip); httpTest.ShouldHaveCalled($"http://{ip}/blackvue_vod.cgi"); Assert.True(!string.IsNullOrEmpty(body)); if (body != null) { Assert.Equal(numRecords * 2, body.ParseBody().Length); } } }
public void CantFindCameraTest(string ip) { var blackVueDownloader = new PCL.BlackVueDownloader(); using (var httpTest = new HttpTest()) { httpTest.SimulateTimeout(); try { blackVueDownloader.QueryCameraForFileList(ip); } catch (Exception e) { Assert.StartsWith("One or more errors occurred.", e.Message); } httpTest.ShouldHaveCalled($"http://{ip}/blackvue_vod.cgi"); } }