Пример #1
0
        public async Task <IActionResult> Index()
        {
            var query  = new GetHistoryQuery();
            var result = await _mediator.Send(query);

            return(View(result.ToList()));
        }
Пример #2
0
        protected override void SetupNewDatabase(DbContextOptions <PreservationContext> dbContextOptions)
        {
            using (var context = new PreservationContext(dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var project = AddProject(context, "P", "Project description");
                var journey = AddJourneyWithStep(context, "J", "S1", AddMode(context, "M1", false), AddResponsible(context, "R1"));
                var rd      = AddRequirementTypeWith1DefWithoutField(context, "Rot", "D", RequirementTypeIcon.Other).RequirementDefinitions.First();

                _tagWithNoHistory = new Tag(TestPlant, TagType.Standard, "TagNo", "Tag description", journey.Steps.First(),
                                            new List <TagRequirement> {
                    new TagRequirement(TestPlant, 2, rd)
                });
                project.AddTag(_tagWithNoHistory);

                _tagWithHistory = new Tag(TestPlant, TagType.Standard, "TagNo1", "Tag description1", journey.Steps.First(),
                                          new List <TagRequirement> {
                    new TagRequirement(TestPlant, 2, rd)
                });
                project.AddTag(_tagWithHistory);

                _historyVoidTag   = new History(TestPlant, "D", _tagWithHistory.ObjectGuid, ObjectType.Tag, EventType.TagVoided);
                _historyCreateTag = new History(TestPlant, "D1", _tagWithHistory.ObjectGuid, ObjectType.Tag, EventType.TagCreated);

                context.History.Add(_historyVoidTag);
                context.History.Add(_historyCreateTag);

                context.SaveChangesAsync().Wait();

                _query = new GetHistoryQuery(_tagWithHistory.Id);
            }
        }
Пример #3
0
        public void Constructor_ShouldSetProperties()
        {
            // Act
            var dut = new GetHistoryQuery(1);

            // Assert
            Assert.AreEqual(1, dut.InvitationId);
        }
Пример #4
0
        public async Task ValidateAsync_OnGetHistoryQuery_ShouldReturnFalse_WhenNoAccessToProject()
        {
            // Arrange
            var query = new GetHistoryQuery(_invitationIdWithoutAccessToProject);

            // act
            var result = await _dut.ValidateAsync(query);

            // Assert
            Assert.IsFalse(result);
        }
Пример #5
0
        public async Task <IActionResult> GetHistory([FromRoute] int accountNumber, [FromBody] HistoryRequest request)
        {
            var getHistoryQuery = new GetHistoryQuery
            {
                AccountNumber = accountNumber,
                StartDate     = request.StartDate,
                EndDate       = request.EndDate
            };
            var history = await _mediator.Send(getHistoryQuery).ConfigureAwait(false);

            return(Ok(history));
        }
Пример #6
0
        protected override void SetupNewDatabase(DbContextOptions <IPOContext> dbContextOptions)
        {
            using (var context = new IPOContext(dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var mcScope = new List <McPkg> {
                    new McPkg(TestPlant, "TestProject", "commno", "mcno", "d", "1|2")
                };

                _invitationWithNoHistory = new Invitation(
                    TestPlant,
                    "project",
                    "title",
                    "description",
                    DisciplineType.DP,
                    new DateTime(),
                    new DateTime(),
                    null,
                    mcScope,
                    null);

                _invitationWithHistory = new Invitation(
                    TestPlant,
                    "project",
                    "title 2",
                    "description",
                    DisciplineType.DP,
                    new DateTime(),
                    new DateTime(),
                    null,
                    mcScope,
                    null);

                context.Invitations.Add(_invitationWithNoHistory);
                context.Invitations.Add(_invitationWithHistory);

                _historyCompleteIpo = new History(TestPlant, "D", _invitationWithHistory.ObjectGuid, EventType.IpoCompleted);
                _historyAcceptIpo   = new History(TestPlant, "D1", _invitationWithHistory.ObjectGuid, EventType.IpoAccepted);

                context.History.Add(_historyCompleteIpo);
                context.History.Add(_historyAcceptIpo);

                context.SaveChangesAsync().Wait();

                _query = new GetHistoryQuery(_invitationWithHistory.Id);
            }
        }
Пример #7
0
        public async Task <IActionResult> GetInfringements(string dni)
        {
            try
            {
                var request = new GetHistoryQuery
                {
                    DriverDni = dni
                };
                var result = await Mediator.Send(request);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
Пример #8
0
 public async Task <IEnumerable <ExchangeHistory> > Handle(GetHistoryQuery request, CancellationToken cancellationToken)
 {
     return(await _moneyExchangeRepository.GetHistory());
 }