Beispiel #1
0
        public async Task ApiContractException()
        {
            var response = await _ticketService.GetTicketAsync(null, "IGNORE");

            var content = await GetContent(response);

            Assert.IsNotNull(content);
            var error = FulcrumError.Parse(content);

            Assert.IsNotNull(error, $"Expected a JSON formatted error. (Content was \"{content}\".");
            ValidateExceptionType <ServerContractException>(error);
        }
Beispiel #2
0
        private async Task VerifyException <TFacadeException, TBllException>(bool expectCopy = false)
            where TFacadeException : FulcrumException
            where TBllException : FulcrumException, new()
        {
            var response = await _ticketService.GetTicketAsync(TicketId, typeof(TFacadeException).Name);

            var content = await GetContent(response);

            Assert.IsNotNull(content);
            var error = FulcrumError.Parse(content);

            Assert.IsNotNull(error, $"Expected a JSON formatted error. (Content was \"{content}\".");
            ValidateExceptionType <TBllException>(error);
            if (typeof(TFacadeException) == typeof(TBllException) && !expectCopy)
            {
                // The following condition has been specially prepared for in the mock service.
                // This would never happen in real life.
                Assert.AreEqual(error.InstanceId, error.Code);
            }
        }