コード例 #1
0
 public ActionResult <Camera> GetCamera(int id)
 {
     try
     {
         return(Ok(_cameraService.GetCamera(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #2
0
ファイル: ServiceTests.cs プロジェクト: dariuskrtn/SafePlace
        public void CameraServiceTest_GetCameraFromDictionary_ReturnsRightCamera()
        {
            ICameraService cameraService = new CameraService();
            Camera         camera0       = cameraService.CreateCamera();
            Camera         camera1       = cameraService.CreateCamera();
            Camera         camera2       = cameraService.CreateCamera();
            Camera         camera3       = cameraService.CreateCamera();

            Assert.IsNotNull(camera0, "Failed to create camera instance");
            Assert.IsNotNull(camera1, "Failed to create camera instance");
            Assert.IsNotNull(camera2, "Failed to create camera instance");
            Assert.IsNotNull(camera3, "Failed to create camera instance");

            Assert.AreEqual(cameraService.GetCamera(camera2.Guid), camera2, "Wrong Camera returned");
        }