Ejemplo n.º 1
0
        public void UnsetUriThrows()
        {
            // Arrange
            OcrClient client = new OcrClient(API_KEY, REGION);

            // Act

            // Assert
            Assert.Throws(typeof(ArgumentOutOfRangeException), () => client.GetRegionalUri(OcrRegions.NotSet));
        }
Ejemplo n.º 2
0
        public void CastsPostResponseToType()
        {
            // Arrange
            byte[]    contentBytes = File.ReadAllBytes(@"..\..\..\OcrTests\AboutUs.png");
            OcrClient client       = new OcrClient(API_KEY, REGION);
            string    url          = client.GetRegionalUri(REGION).ToString();
            object    response;

            // Act
            using (ByteArrayContent content = new ByteArrayContent(contentBytes))
            {
                response = Task.Run(() => client.Post <OcrResponse>(url, content, "Ocp-Apim-Subscription-Key", API_KEY)).Result;
            }

            // Assert
            Assert.NotNull(response);
            Assert.IsType(typeof(OcrResponse), response);
        }