Beispiel #1
0
 public IHttpActionResult Get([FromUri] Guid id)
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         var margin = MarginBusinessLogic.GetMargin(id);
         return(Ok(MarginModel.ToModel(margin)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Beispiel #2
0
 public IHttpActionResult Get()
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         var margins = MarginBusinessLogic.GetMargins();
         IList <MarginModel> marginsModel = MarginModel.ToModel(margins).ToList();
         return(Ok(marginsModel));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Beispiel #3
0
 public void TestInitialize()
 {
     margin      = Utils.CreateMarginForTest();
     marginModel = MarginModel.ToModel(margin);
     text        = Utils.CreateTextForTest();
     textModel   = TextModel.ToModel(text);
     user        = Utils.CreateUserForTest();
     userModel   = UserModel.ToModel(user);
     mockMarginAuthorizationLogic = new Mock <IAuthorizationBusinessLogic>();
     mockMarginBusinessLogic      = new Mock <IMarginBusinessLogic>();
     mockAuditLogBusinessLogic    = new Mock <IAuditLogBussinesLogic>();
     marginController             = new MarginController(mockMarginBusinessLogic.Object, mockMarginAuthorizationLogic.Object, mockAuditLogBusinessLogic.Object);
     InitializeToken();
 }
Beispiel #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();
        }
Beispiel #5
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();
        }