public async Task ReferenceController_Send_NullReferenceTest()
        {
            var request = new SendReferenceRequest
            {
                Delivery = new Delivery
                {
                    Method = Constants.DeliveryMethodBO
                }
            };

            var _controller = new ReferenceController(new Repository(), new PrintServerBridge(), new EventHub())
            {
                Configuration = Helper.CreateHttpConfiguration(),
                Request       = new HttpRequestMessage()
            };

            var response = await(await _controller.Send("0", request)).ExecuteAsync(new CancellationToken());

            Assert.AreEqual(response.StatusCode, HttpStatusCode.NotFound);

            AdditionalInformation result = null;

            response.TryGetContentValue(out result);

            Assert.IsNotNull(result);
            Assert.NotNull(result.Errors);
            Assert.IsTrue(result.Errors.Where(e => e.Code == "150").Any());
        }
        public async Task ReferenceController_Send_BadEHTest()
        {
            var request = new SendReferenceRequest
            {
                Delivery = new Delivery
                {
                    Method = Constants.DeliveryMethodEmail,
                    Email  = "TEST"
                }
            };

            var repository = new Repository();

            repository.References.Add("0", new Reference {
                Number = "0", Status = Constants.ReferenceStatusPdfOk
            });

            var _controller = new ReferenceController(repository, new PrintServerBridge(), new BadEventHub())
            {
                Configuration = Helper.CreateHttpConfiguration(),
                Request       = new HttpRequestMessage()
            };

            var response = await(await _controller.Send("0", request)).ExecuteAsync(new CancellationToken());

            Assert.AreEqual(response.StatusCode, HttpStatusCode.InternalServerError);

            AdditionalInformation result = null;

            response.TryGetContentValue(out result);

            Assert.IsNotNull(result);
            Assert.NotNull(result.Errors);
            Assert.IsTrue(result.Errors.Where(e => e.Code == "101").Any());
        }
        public async Task ReferenceController_SendTest()
        {
            var request = new SendReferenceRequest
            {
                Delivery = new Delivery
                {
                    Method = Constants.DeliveryMethodBO
                }
            };

            var repository = new Repository();

            repository.References.Add("0", new Reference {
                Number = "0", Status = Constants.ReferenceStatusPdfOk
            });

            var _controller = new ReferenceController(repository, new PrintServerBridge(), new EventHub())
            {
                Configuration = Helper.CreateHttpConfiguration(),
                Request       = new HttpRequestMessage()
            };

            var response = await(await _controller.Send("0", request)).ExecuteAsync(new CancellationToken());

            Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
            Assert.AreEqual(repository.References["0"].Status, Constants.ReferenceStatusDelivered);
        }