コード例 #1
0
        public void CreateAuditLogBL_WithParameters_Ok()
        {
            IAuditLogDataAccess auditLogDataAccess = new AuditLogDataAccess();

            IAuditLogBussinesLogic auditLogBL = new AuditLogBussinesLogic(auditLogDataAccess);

            Assert.IsNotNull(auditLogBL);
        }
コード例 #2
0
 public IHttpActionResult Delete([FromUri] Guid id)
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         DocumentBusinessLogic.DeleteDocument(id);
         AuditLogBussinesLogic.CreateLog("Document", id, Utils.GetUsername(Request), ActionPerformed.DELETE);
         return(Ok("Document deleted"));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #3
0
        public IHttpActionResult Post([FromBody] DocumentModel documentModel)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
                documentModel.CreatorUser = Utils.GetCreatorUser(Request, UserBusinessLogic);

                DocumentBusinessLogic.AddDocument(documentModel.ToEntity());
                AuditLogBussinesLogic.CreateLog("Document", documentModel.Id, Utils.GetUsername(Request), ActionPerformed.CREATE);
                return(Ok(documentModel));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #4
0
        public IHttpActionResult Put([FromUri] Guid id, [FromBody] DocumentModel documentModel)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);

                documentModel.Id = id;

                DocumentBusinessLogic.ModifyDocument(documentModel.ToEntity());
                AuditLogBussinesLogic.CreateLog("Document", documentModel.Id, Utils.GetUsername(Request), ActionPerformed.MODIFY);
                return(Ok("Document Modified"));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #5
0
        public IHttpActionResult Post([FromUri] Guid documentId, [FromUri] int index, [FromBody] ParagraphModel documentPart)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);

                var paragraph = documentPart.ToEntity();
                DocumentBusinessLogic.AddDocumentParagraphAt(documentId, index, paragraph);

                AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY);
                return(Ok(documentPart));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #6
0
        public IHttpActionResult Post([FromUri] Guid documentId, [FromUri] MarginAlign align, [FromBody] MarginModel documentPart)
        {
            try
            {
                Utils.IsAValidToken(Request, AuthorizationBusinessLogic);

                var body = documentPart.ToEntity();
                DocumentBusinessLogic.SetDocumentMargin(documentId, align, body);

                AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY);
                return(Ok(documentPart));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #7
0
        public void IntegrationTest_ExpectedParameters_Ok()
        {
            var requestMessage = new HttpRequestMessage();
            ITextBusinessLogic          textBL = new TextBusinessLogic(new TextDataAccess());
            IUserDataAccess             userDa = new UserDataAccess();
            IAuthorizationBusinessLogic auth   = new AuthorizationBusinessLogic(userDa);
            IAuditLogBussinesLogic      audit  = new AuditLogBussinesLogic();
            TextController textC = new TextController(textBL, auth, audit);

            textC.Request = requestMessage;
            TextModel text2 = TextModel.ToModel(Utils.CreateTextForTest());

            textC.Post(textModel);
            textC.Post(text2);
            text2.TextContent = "modified";
            textC.Put(text2.Id, text2);
            textC.Delete(textModel.Id);
            IHttpActionResult statusObtained = textC.Get();
        }
コード例 #8
0
        public void IntegrationTest_ExpectedParameters_Ok()
        {
            var requestMessage = new HttpRequestMessage();
            IMarginBusinessLogic        marginBL = new MarginBusinessLogic(new MarginDataAccess());
            IUserDataAccess             userDa   = new UserDataAccess();
            IAuthorizationBusinessLogic auth     = new AuthorizationBusinessLogic(userDa);
            IAuditLogBussinesLogic      audit    = new AuditLogBussinesLogic();
            MarginController            marginC  = new MarginController(marginBL, auth, audit);

            marginC.Request = requestMessage;
            MarginModel margin2 = MarginModel.ToModel(Utils.CreateMarginForTest());

            marginC.Post(marginModel);
            marginC.Post(margin2);
            marginC.Get(margin.Id);
            margin2.OwnStyleClass = "modified";
            marginC.Put(margin2.Id, margin2);
            marginC.Delete(marginModel.Id);
            IHttpActionResult statusObtained = marginC.Get();
        }
コード例 #9
0
        public void CreateAuditLogBL_WithoutParameters_Ok()
        {
            IAuditLogBussinesLogic auditLogBL = new AuditLogBussinesLogic();

            Assert.IsNotNull(auditLogBL);
        }