Exemplo n.º 1
0
 public ResponseMessageWrap <int> Update([FromBody] Paper paper)
 {
     return(new ResponseMessageWrap <int>
     {
         Body = PaperService.Update(paper)
     });
 }
        public override void Execute(InvokerArgs args)
        {
            base.Execute (args);

            var svc = new PaperService();
            svc.GetPaperReferences(AM.CurrentPaper.id, onSuccess, onFail);
        }
Exemplo n.º 3
0
 public ResponseMessageWrap <int> Insert([FromBody] Paper paper)
 {
     return(new ResponseMessageWrap <int>
     {
         Body = PaperService.Insert(paper)
     });
 }
Exemplo n.º 4
0
 public ResponseMessageWrap <int> DeleteById(long id)
 {
     return(new ResponseMessageWrap <int>
     {
         Body = PaperService.DeleteById(id)
     });
 }
        //        [Inject]
        //        public PapersReceivedInvoker PapersReceived;
        // This injection throws an error
        //        [Inject]
        //        public PapersListMediator PM;
        public override void Execute(InvokerArgs args)
        {
            base.Execute (args);

            var svc = new PaperService();
            svc.GetPapers(onSuccess, onFail);
        }
Exemplo n.º 6
0
        public override void Execute(InvokerArgs args)
        {
            base.Execute(args);

            var svc = new PaperService();

            svc.GetPaperReferences(AM.CurrentPaper.id, onSuccess, onFail);
        }
//		[Inject]
//		public PapersReceivedInvoker PapersReceived;

        // This injection throws an error
//		[Inject]
//		public PapersListMediator PM;

        public override void Execute(InvokerArgs args)
        {
            base.Execute(args);

            var svc = new PaperService();

            svc.GetPapers(onSuccess, onFail);
        }
 /// <summary>
 /// Creates and adds a few ItemViewModel objects into the Items collection.
 /// </summary>
 public void LoadData()
 {
     _paperModel = PaperModel.FromFile();
     if (_paperModel.Papers.Count > 0)
     {
         this.Papers.Source          = this.Items = _paperModel.Papers;
         Papers.View.CurrentChanged += handleCurrentPaperChanged;
         this.IsDataLoaded           = true;
         NotifyPropertyChanged("IsDataLoaded");
     }
     else
     {
         var svc = new PaperService();
         svc.GetPapers(onPapersReceived, onError);
     }
 }
        public void GetPaperReturnsExceptionTest()
        {
            //Arrange
            var mockPaperService = new Mock <IPaperService>();
            var mockPaperDAL     = new Mock <IPaperDAL>();

            mockPaperDAL.Setup(x => x.Get(It.IsAny <Guid>())).Throws(new Exception());
            mockPaperService.Setup(x => x.Get(It.IsAny <Guid>())).Throws(new Exception());

            //Act
            PaperService paperService = new PaperService(mockPaperDAL.Object);
            var          result       = paperService.Get(new Guid());

            //Assert
            //Expected exception was thrown
        }
        public void GetPaperReturnsNullTest()
        {
            //Arrange
            var mockPaperService = new Mock <IPaperService>();
            var mockPaperDAL     = new Mock <IPaperDAL>();

            mockPaperDAL.Setup(x => x.Get(It.IsAny <Guid>())).Returns((Paper)null);
            mockPaperService.Setup(x => x.Get(It.IsAny <Guid>())).Returns((Paper)null);

            //Act
            PaperService paperService = new PaperService(mockPaperDAL.Object);
            var          result       = paperService.Get(new Guid());

            //Assert
            Assert.IsNull(result);
        }
        public void GetPaperSuccessfuTest()
        {
            //Arrange
            Paper expectedPaper = new Paper()
            {
                Id            = new Guid(),
                DocumentType  = DocumentType.CaseStudy,
                Author        = "Juan",
                Title         = "Sample",
                YearSubmitted = "2017"
            };
            var mockPaperService = new Mock <IPaperService>();
            var mockPaperDAL     = new Mock <IPaperDAL>();

            mockPaperService.Setup(x => x.Get(It.IsAny <Guid>())).Returns(expectedPaper);
            mockPaperDAL.Setup(x => x.Get(It.IsAny <Guid>())).Returns(expectedPaper);

            //Act
            PaperService paperService = new PaperService(mockPaperDAL.Object);
            var          result       = paperService.Get(new Guid());

            //Assert
            Assert.AreSame(expectedPaper, result);
        }
Exemplo n.º 12
0
 public PapersViewModel(PaperService paperService)
 {
     _paperService = paperService;
 }
Exemplo n.º 13
0
 public PaperController(ApplicationContext context, PaperService paperService)
 {
     db = context;
     this.paperService = paperService;
 }
Exemplo n.º 14
0
 public PaperController(PaperService service)
 {
     _service = service;
 }
        /// <summary>
        /// Creates and adds a few ItemViewModel objects into the Items collection.
        /// </summary>
        public void LoadData(int paperId)
        {
            var svc = new PaperService();

            svc.GetPaperReferences(paperId, onReferencesReceived, onError);
        }
Exemplo n.º 16
0
 public PaperController(PaperService paperService, IPaperRepository paperRepository)
 {
     PaperService    = paperService;
     PaperRepository = paperRepository;
 }
Exemplo n.º 17
0
 public PapersController()
 {
     this.serivce = new PaperService(new PaperRepository());
 }
Exemplo n.º 18
0
 public PaperController()
 {
     _paperService           = new PaperService();
     _modelValidationService = new ModelValidationService();
     _modelConversionService = new ModelConversionService();
 }