public void ConfirmCollect_Valid()
        {
            // Arrange
            var expected   = new StatusService(context).FindStatusByStatusId(10);
            var controller = new DisbursementAPIController()
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration(),
                Context       = context,
            };

            // Act
            IHttpActionResult actionResult = controller.ConfirmCollection(new DisbursementIdViewModel()
            {
                DisbursementId = "DAPICONTROLTEST",
            });
            var contentResult = actionResult as OkNegotiatedContentResult <MessageViewModel>;

            // Assert
            Assert.IsNotNull(contentResult);
            Assert.IsNotNull(contentResult.Content);
            Assert.AreEqual(contentResult.Content.Message, "Collection confirmed");
            var result = new DisbursementRepository(context).FindById("DAPICONTROLTEST");

            Assert.AreEqual(expected.Name, result.Status.Name);
        }
        public void GetAllDisbursements_ContainsResult()
        {
            // Arrange
            var expectedId       = "DAPICONTROLTEST";
            var expectedQuantity = 1;
            var controller       = new DisbursementAPIController()
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration(),
            };

            // Act
            IHttpActionResult actionResult = controller.GetAllDisbursements();
            var contentResult = actionResult as OkNegotiatedContentResult <IEnumerable <DisbursementMobileViewModel> >;

            // Assert
            Assert.IsNotNull(contentResult);
            Assert.IsNotNull(contentResult.Content);
            Assert.IsTrue(contentResult.Content.Select(d => d.DisbursementId).Contains(expectedId));
            Assert.IsTrue(contentResult.Content.Select(d => d.DisbursementDetails.Select(dd => dd.Qty)).FirstOrDefault().Contains(expectedQuantity));
        }
        public void ConfirmCollect_BadRequest()
        {
            // Arrange
            var controller = new DisbursementAPIController()
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration(),
                Context       = context,
            };
            var disbursement = disbursementRepository.FindById("DAPICONTROLTEST");

            disbursement.Status = new StatusService(context).FindStatusByStatusId(10);
            disbursementRepository.Save(disbursement);

            // Act
            IHttpActionResult actionResult = controller.ConfirmCollection(new DisbursementIdViewModel()
            {
                DisbursementId = "DAPICONTROLTEST",
            });

            // Assert
            // Assert
            Assert.IsInstanceOfType(actionResult, typeof(BadRequestErrorMessageResult));
        }