예제 #1
0
        public void VerifyGetMediaAuthTicketUnhandledException()
        {
            _mediaApplicationMock.Setup
            (
                u => u.GetAuthorizationTicket(ControllerTestDataBuilder.Query))
            .Returns(new MediaResponse <string>
            {
                Code    = (int)ResponseCodes.ResourceNotfound,
                Message = Constants.ResourceNotFoundMessage,
                Data    = null
            });
            var result           = _mediaController.GetMediaAuthTicket(ControllerTestDataBuilder.TenantId);
            var resultString     = result.Content.ReadAsStringAsync();
            var objectsResult    = JObject.Parse(resultString.Result);
            var resultStatusCode = result.StatusCode;

            Assert.AreEqual(HttpStatusCode.NotFound, resultStatusCode,
                            "Expected status is not equal to actual");
            Assert.AreEqual(((int)ResponseCodes.ResourceNotfound).ToString(), objectsResult["Code"].ToString(),
                            "Expected response code is not matching with actual result");
            Assert.AreEqual(Constants.ResourceNotFoundMessage, (string)objectsResult["Message"],
                            "Expected Message is not matching with actual message");
        }