Пример #1
0
        public void CreatesRequestAudit()
        {
            var metadata = new Dictionary <string, object>()
            {
                { "residentId", 333 }, { "caseNoteId", 555 }
            };

            CreateRequestAuditRequest requestAuditRequest = new CreateRequestAuditRequest()
            {
                ActionName = "view_resident",
                UserName   = _faker.Person.Email,
                Metadata   = metadata
            };

            _databaseGateway.CreateRequestAudit(requestAuditRequest);

            var requestAudit = DatabaseContext.RequestAudits.FirstOrDefault();

            requestAudit?.ActionName.Should().Be(requestAuditRequest.ActionName);
            requestAudit?.UserName.Should().Be(requestAuditRequest.UserName);
            requestAudit?.Timestamp.Should().BeCloseTo(DateTime.Now, precision: 1000);
            requestAudit?.Metadata.Should().BeEquivalentTo(requestAuditRequest.Metadata);
        }