Example #1
0
        public void CreateEventQuerySuccessReturnsEventId()
        {
            // Arrange
            var examination        = new MedicalExaminer.Models.Examination();
            var theEvent           = new Mock <OtherEvent>(); // only other event has been implemented so far.
            var connectionSettings = new Mock <IExaminationConnectionSettings>();
            var query = new CreateEventQuery("1", theEvent.Object);

            theEvent.Object.UserId = "a";
            var dbAccess = new Mock <IDatabaseAccess>();

            dbAccess.Setup(db => db.GetItemByIdAsync <MedicalExaminer.Models.Examination>(connectionSettings.Object,
                                                                                          It.IsAny <string>()))
            .Returns(Task.FromResult(examination)).Verifiable();

            dbAccess.Setup(db => db.UpdateItemAsync(connectionSettings.Object,
                                                    It.IsAny <MedicalExaminer.Models.Examination>())).Returns(Task.FromResult(examination)).Verifiable();

            var sut = new CreateEventService(dbAccess.Object, connectionSettings.Object, _urgencySettingsMock.Object);

            // Act
            var result = sut.Handle(query);

            // Assert
            dbAccess.Verify(db => db.UpdateItemAsync(connectionSettings.Object,
                                                     It.IsAny <MedicalExaminer.Models.Examination>()), Times.Once);

            Assert.NotNull(result.Result);
            Assert.Equal("a", examination.LastModifiedBy);
        }
Example #2
0
        public void CreateEventOnExaminationWithNoUrgencyIndicatorsSuccessReturnsExaminationWithUrgencyScoreZero()
        {
            // Arrange
            var examination = new MedicalExaminer.Models.Examination()
            {
                ChildPriority    = false,
                CoronerPriority  = false,
                CulturalPriority = false,
                FaithPriority    = false,
                OtherPriority    = false,
                CreatedAt        = DateTime.Now.AddDays(-3)
            };
            var theEvent           = new Mock <OtherEvent>(); // only other event has been implemented so far.
            var connectionSettings = new Mock <IExaminationConnectionSettings>();
            var query = new CreateEventQuery("1", theEvent.Object);

            theEvent.Object.UserId = "a";
            var dbAccess = new Mock <IDatabaseAccess>();

            dbAccess.Setup(db => db.GetItemByIdAsync <MedicalExaminer.Models.Examination>(connectionSettings.Object,
                                                                                          It.IsAny <string>()))
            .Returns(Task.FromResult(examination)).Verifiable();

            dbAccess.Setup(db => db.UpdateItemAsync(connectionSettings.Object,
                                                    It.IsAny <MedicalExaminer.Models.Examination>())).Returns(Task.FromResult(examination)).Verifiable();

            var sut = new CreateEventService(dbAccess.Object, connectionSettings.Object, _urgencySettingsMock.Object);

            // Act
            var result = sut.Handle(query);

            // Assert
            examination.IsUrgent().Should().BeFalse();
            examination.LastModifiedBy.Should().Be("a");
        }
Example #3
0
        public IEnumerable <Event> Gets()
        {
            CreateEventService _service = new CreateEventService(_unitOfWork);
            var events = _service.ConsultAll();

            return(events);
        }
Example #4
0
        public ActionResult <CreateEventService> Post(CreateEventRequest request)
        {
            CreateEventService  _service = new CreateEventService(_unitOfWork);
            CreateEventResponse response = _service.Execute(request);

            return(Ok(response));
        }
Example #5
0
        private void savebutton_Click(object sender, EventArgs e)
        {
            CreateEventService CES = new CreateEventService();
            int result             = CES.AddNewCreateEvent(enametextbox.Text, datepiker.Value, comboBox.Text, edtextbox.Text);

            MessageBox.Show("Save SSuccesfully !");
            Reset();

            Home h = new Home();

            h.Show();
            this.Hide();
        }
Example #6
0
        public void CreateEventQueryIsNullThrowsException()
        {
            // Arrange
            var connectionSettings = new Mock <IExaminationConnectionSettings>();
            CreateEventQuery query = null;
            var dbAccess           = new Mock <IDatabaseAccess>();

            var sut = new CreateEventService(dbAccess.Object, connectionSettings.Object, _urgencySettingsMock.Object);

            // Act
            Action act = () => sut.Handle(query).GetAwaiter().GetResult();

            act.Should().Throw <ArgumentNullException>();
        }
Example #7
0
        public void EnviarSolicitudEvent()
        {
            CreateEventService _eventService = new CreateEventService(new UnitOfWork(_context));
            var eventRequest = new CreateEventRequest {
                DocumentTeacher = "1035", Title = "Ready Player One", NumberOfAuthors = 2, Credit = true, EventPlace = "", EventType = "Internacional", Isbn = "ssad", Issn = "asdfas", Languaje = "EspaƱol", Memories = "carlos", Name = "Mineria de datos en la actualidad", EventWeb = "www.con.com", EventDate = DateTime.Now
            };

            _eventService.Execute(eventRequest);

            Event events = _eventService.Consult(eventRequest.Isbn);

            SendRequestService _sendRequestService = new SendRequestService(new UnitOfWork(_context));
            var propertiesRequest = new SendRequestProperties {
                TitleProductivity = "Ready Player One"
            };
            var responseRequest = _sendRequestService.SendProductivity(propertiesRequest);

            Assert.AreEqual("La solicitud de la productividad Ready Player One fue enviada con exito, su puntaje estimado es 84.", responseRequest.Menssage);
        }
Example #8
0
        private void Home_Load(object sender, EventArgs e)
        {
            CreateEventService CES = new CreateEventService();

            loadCreateEventDataGridView.DataSource = CES.GetCreateEventsList();
        }