Exemple #1
0
 public IHttpActionResult Get([FromUri] Guid paragraphId)
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         var paragraph = ParagraphBusinessLogic.GetParagraph(paragraphId);
         return(Ok(ParagraphModel.ToModel(paragraph)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemple #2
0
 public void TestInitialize()
 {
     paragraph      = Utils.CreateParagraphForTest();
     paragraphModel = ParagraphModel.ToModel(paragraph);
     text           = Utils.CreateTextForTest();
     textModel      = TextModel.ToModel(text);
     user           = Utils.CreateUserForTest();
     userModel      = UserModel.ToModel(user);
     mockParagraphAuthorizationLogic = new Mock <IAuthorizationBusinessLogic>();
     mockParagraphBusinessLogic      = new Mock <IParagraphBusinessLogic>();
     mockAuditLogBusinessLogic       = new Mock <IAuditLogBussinesLogic>();
     paragraphController             = new ParagraphController(mockParagraphBusinessLogic.Object, mockParagraphAuthorizationLogic.Object, mockAuditLogBusinessLogic.Object);
     InitializeToken();
 }
Exemple #3
0
 // GET: api/Paragraph
 public IHttpActionResult Get()
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         var paragraphs = ParagraphBusinessLogic.GetParagraphs();
         IList <ParagraphModel> paragraphsModel = ParagraphModel.ToModel(paragraphs).ToList();
         return(Ok(paragraphsModel));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemple #4
0
        public void TestInitialize()
        {
            document       = Utils.CreateDocumentForTest();
            documentModel  = DocumentModel.ToModel(document);
            paragraph      = Utils.CreateParagraphForTest();
            paragraphModel = ParagraphModel.ToModel(paragraph);
            margin         = Utils.CreateMarginForTest();
            marginModel    = MarginModel.ToModel(margin);
            user           = Utils.CreateUserForTest();
            userModel      = UserModel.ToModel(user);
            mockDocumentAuthorizationLogic = new Mock <IAuthorizationBusinessLogic>();
            mockDocumentBusinessLogic      = new Mock <IDocumentBusinessLogic>();
            mockAuditLogBusinessLogic      = new Mock <IAuditLogBussinesLogic>();
            mockUserBusinessLogic          = new Mock <IUserBusinessLogic>();

            documentController = new DocumentController(mockDocumentBusinessLogic.Object, mockDocumentAuthorizationLogic.Object, mockAuditLogBusinessLogic.Object, mockUserBusinessLogic.Object);
            InitializeToken();
        }