public void TestIsPointWithinWebCamRadiusOfVisibility() { //Arrange var pointInRangeOfId0Only = new Point { XCoord = 1, YCoord = 1 }; var pointInRangeOfId2Only = new Point { XCoord = 9, YCoord = 9 }; var pointInRangeOfId1AndId2 = new Point { XCoord = 4, YCoord = 4 }; var pointNotInRange = new Point { XCoord = 100, YCoord = 100 }; var mockRepository = new Mock<IMyBigBroRepository>(); mockRepository.Setup(x => x.Set<global::Infostructure.MyBigBro.DataModel.Models.WebCam>()).Returns(new List<WebCam>() { new global::Infostructure.MyBigBro.DataModel.Models.WebCam() {Id = 0, Name = "bernard", XCoord = 2, YCoord = 2, RadiusOfVisibility = 3}, new global::Infostructure.MyBigBro.DataModel.Models.WebCam() {Id = 2, Name = "bernard2", XCoord = 8, YCoord = 8, RadiusOfVisibility = 7} }.AsQueryable()); var location = new Location(mockRepository.Object); //Act var pointInRangeOfId0OnlyResult = location.IsPointWithinWebCamRadiusOfVisibility(pointInRangeOfId0Only, false); var pointInRangeOfId2OnlyResult = location.IsPointWithinWebCamRadiusOfVisibility(pointInRangeOfId2Only, false); var pointInRangeOfId1AndId2Result = location.IsPointWithinWebCamRadiusOfVisibility(pointInRangeOfId1AndId2, false); var pointNotInRangeResult = location.IsPointWithinWebCamRadiusOfVisibility(pointNotInRange, false); //Assert Assert.IsTrue(pointInRangeOfId0OnlyResult); Assert.IsTrue(pointInRangeOfId2OnlyResult); Assert.IsTrue(pointInRangeOfId1AndId2Result); Assert.IsFalse(pointNotInRangeResult); }
public void TestImageCaptureAndStorage() { var context = new MyBigBroContext(Settings.Default.connectionString); var repository = new MyBigBroRepository(); var location = new Location(repository); var geometry = new Geometry(); repository.Context = context; location.MyBigBroRepository = repository; var pointInRangeOfWebCamId4Only = new Point { XCoord = 174.706, YCoord = -36.872 }; if (location.IsPointWithinWebCamRadiusOfVisibility(pointInRangeOfWebCamId4Only)) { var webCamControl = new WebCamControl(new AwsStorageServiceAgent(), repository, geometry); webCamControl.MyBigBroRepository = repository; webCamControl.StorageServiceAgent = new AwsStorageServiceAgent(); var webCams = location.GetWebCamsWithinWebCamRadiusOfVisibility(pointInRangeOfWebCamId4Only); foreach (var webCam in webCams) { webCamControl.WebCam = webCam; webCamControl.WebCamImage = new WebCamImage(); webCamControl.CapturedImage = new CapturedImage(); webCamControl.CaptureCurrentImage(new WebCamDataRequest()); webCamControl.StoreCapturedImage(); } } }
public void TestIsPointWithinWebCamRadiusOfVisibility() { //Arrange var pointInRangeOfId0Only = new Point { XCoord = 1, YCoord = 1 }; var pointInRangeOfId2Only = new Point { XCoord = 9, YCoord = 9 }; var pointInRangeOfId1AndId2 = new Point { XCoord = 4, YCoord = 4 }; var pointNotInRange = new Point { XCoord = 100, YCoord = 100 }; var repository = new MyBigBroRepository() { Context = new MyBigBroContext(Settings.Default.connectionString) }; var location = new Location(repository); //Act var pointInRangeOfId0OnlyResult = location.IsPointWithinWebCamRadiusOfVisibility(pointInRangeOfId0Only); var pointInRangeOfId2OnlyResult = location.IsPointWithinWebCamRadiusOfVisibility(pointInRangeOfId2Only); var pointInRangeOfId1AndId2Result = location.IsPointWithinWebCamRadiusOfVisibility(pointInRangeOfId1AndId2); var pointNotInRangeResult = location.IsPointWithinWebCamRadiusOfVisibility(pointNotInRange); //Assert Assert.IsTrue(pointInRangeOfId0OnlyResult); Assert.IsTrue(pointInRangeOfId2OnlyResult); Assert.IsTrue(pointInRangeOfId1AndId2Result); Assert.IsFalse(pointNotInRangeResult); }