Exemple #1
0
        public ActionResult <ListOf <EventHistoryData> > ShowLogs([FromQuery] SearchEventByAggregate query)
        {
            var clients = _eventStoreAppService.GetEvents(query);

            if (!User.IsInRole("Administrator") && !User.HasClaim(c => c.Type == "is4-manager") && query.Aggregate != _user.Username)
            {
                foreach (var client in clients.Collection)
                {
                    client.MarkAsSensitiveData();
                }
            }

            return(ResponseGet(clients));
        }
        public async Task Should_Get_Events_And_Have_Details_As_Json()
        {
            var command = UserViewModelFaker.GenerateUserViewModel().Generate();
            var result  = await _userAppService.Register(command);

            result.Should().BeTrue();
            _database.Users.FirstOrDefault(f => f.UserName == command.Username).Should().NotBeNull();

            var events = _eventStoreAppService.GetEvents(new SearchEventByAggregate());

            events.Collection.Should().HaveCountGreaterOrEqualTo(1);
            foreach (var eventHistoryData in events.Collection)
            {
                eventHistoryData.Details.Should().Contain("{");
            }
        }