Esempio n. 1
0
        public async void TestDetect()
        {
            // test no face image
            IFormFile formFile = CreateFormFile("test-none.jpg");
            var       result   = await _controller.Detect(formFile);

            var             jsonResult = Assert.IsType <JsonResult>(result);
            List <FaceInfo> faceList   = (List <FaceInfo>)jsonResult.Value;

            Assert.Empty(faceList);

            // test one face image
            formFile = CreateFormFile("test-one.jpg");
            result   = await _controller.Detect(formFile);

            jsonResult = Assert.IsType <JsonResult>(result);
            faceList   = (List <FaceInfo>)jsonResult.Value;
            Assert.Single(faceList);

            // test multi-face image
            formFile = CreateFormFile("test-three.jpg");
            result   = await _controller.Detect(formFile);

            jsonResult = Assert.IsType <JsonResult>(result);
            faceList   = (List <FaceInfo>)jsonResult.Value;
            Assert.Equal(3, faceList.Count());
        }