public void DealDocumentsController_Documents_NotFoundAPIException(DocuemntSearchCriteria criteria)
        {
            #region Arrange

            SetupUserIdentity();
            SetupDealKeyDocumentsRepository(out Mock <IDealDocumentsRepository> dealDocumentsRepository, criteria);

            #endregion

            #region Act

            var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPGET), $"{AppSettings.BASEURL}{RouteHelper.DealsRoutePrefix}/{criteria.FileNumber}/keydoctypes/{criteria.GetDoctypes}");
            DealDocumentsController dealDocumentController = CreateDealDocumentsController(httpRequest, dealDocumentsRepository.Object);

            #endregion

            #region Assert

            Assert.Throws(typeof(NotFoundAPIException), delegate { dealDocumentController.Get(criteria.FileNumber.ToString(), criteria.GetDoctypes); });
            Assert.Throws(typeof(NotFoundAPIException), delegate { dealDocumentController.Get(criteria.FileNumber.ToString()); });
            Assert.Throws(typeof(NotFoundAPIException), delegate { dealDocumentController.Get(criteria.FileNumber.ToString(), criteria.DocumentId, criteria.FileContents); });
            Assert.Throws(typeof(NotFoundAPIException), delegate { dealDocumentController.Get(criteria.FileNumber.ToString(), criteria.DocumentId, criteria.PageNumber); });

            #endregion
        }
        public void DealDocumentsController_GetKeyDocuments_OKResponse(DocuemntSearchCriteria criteria)
        {
            #region Arrange

            SetupUserIdentity();
            SetupDealKeyDocumentsRepository(out Mock <IDealDocumentsRepository> dealDocumentsRepository, criteria);
            var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPGET), $"{AppSettings.BASEURL}{RouteHelper.DealsRoutePrefix}/{criteria.FileNumber}/keydoctypes/{criteria.GetDoctypes}");
            DealDocumentsController dealDocumentController = CreateDealDocumentsController(httpRequest, dealDocumentsRepository.Object);

            #endregion

            #region Act
            var contentResult = dealDocumentController.Get(criteria.FileNumber.ToString(), criteria.GetDoctypes) as NegotiatedContentResult <ResponseCollection <DealDocuments> >;
            #endregion

            #region Expected Data

            var expectedDocuments = new DealDocuments()
            {
                KeyDocid        = 0,
                FileNumber      = 103324,
                Producer        = 0,
                Docid           = "",
                DocName         = "",
                SortOrder       = 1,
                Location        = "",
                Drawer          = "",
                Folderid        = "06",
                FolderName      = "Final Documents",
                DocType         = "Contract - Final RI",
                ErmsClassType   = "",
                FileType        = "",
                DmsPath         = "u-rdc-wsdms01\\active\\[Deal]\\06-Final Documents ([DealNum])",
                ItemCategoryid  = 4,
                ErmsCategory    = "Signed Contract",
                LastUpdatedUser = "",
                LastTimeStamp   = DateTime.Parse("2019-01-17T15:29:29.523"),
                DmsCreated      = DateTime.Parse("2019-01-17T15:29:29.523"),
                DmsUpdated      = DateTime.Parse("2019-01-17T15:29:29.523")
            };

            #endregion

            #region Assert

            Assertions.AssertOkResponse(contentResult);
            for (int i = 0; i <= contentResult.Content.results.Count - 1; i++)
            {
                var actualData = contentResult.Content.results[i].data;
                Assertions.AssertData(expectedDocuments, actualData);
                Assert.IsEmpty(contentResult.Content.results[i].messages);
            }

            #endregion
        }
        private DealDocumentsController CreateDealDocumentsController(HttpRequestMessage httpRequest, IDealDocumentsRepository dealDocumentsRepository)
        {
            DealDocumentsManager dealDocumentsManager = new DealDocumentsManager(userManager.Object, cacheStoreManager.Object, mockLogManager.Object, dealDocumentsRepository, dealLockManager.Object, transformationManager);

            DealAPIManager dealAPIManager = new DealAPIManager(userManager.Object, cacheStoreManager.Object, mockLogManager.Object, dealDocumentsManager);

            DealDocumentsController dealDocumentController = new DealDocumentsController(userManager.Object, dealAPIManager)
            {
                Request       = httpRequest,
                Configuration = new HttpConfiguration()
            };

            return(dealDocumentController);
        }
        public void DealDocumentsController_Documents_OnFailedDMSRequest(DocuemntSearchCriteria criteria)
        {
            #region Arrange

            SetupUserIdentity();
            SetupDealKeyDocumentsRepository(out Mock <IDealDocumentsRepository> dealDocumentsRepository, criteria);
            var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPGET), $"{AppSettings.BASEURL}{RouteHelper.DealsRoutePrefix}/{criteria.FileNumber}/keydoctypes/{criteria.GetDoctypes}");
            DealDocumentsController dealDocumentController = CreateDealDocumentsController(httpRequest, dealDocumentsRepository.Object);
            #endregion

            #region Act
            IHttpActionResult actionResult = dealDocumentController.Get(criteria.FileNumber.ToString(), criteria.DocumentId, criteria.FileContents);
            #endregion

            #region Assert
            Assert.AreEqual(HttpStatusCode.BadRequest, ((ResponseMessageResult)actionResult).Response.StatusCode);
            #endregion
        }