public async Task SaveAuditResultSavesCorrectAudit()
        {
            // Arrange
            await using var context = JosekiTestsDb.CreateUniqueContext();
            var parser = new ConfigurationParser("config.sample.yaml");
            var db     = new MssqlJosekiDatabase(context, parser);
            var audit  = new Audit
            {
                ComponentId   = Guid.NewGuid().ToString(),
                ComponentName = Guid.NewGuid().ToString(),
                Date          = DateTime.UtcNow,
                ScannerId     = Guid.NewGuid().ToString(),
                Id            = Guid.NewGuid().ToString(),
            };

            // Act & Assert
            context.Audit.Should().HaveCount(0);
            await db.SaveAuditResult(audit);

            context.Audit.Should().HaveCount(1);

            var actual = await context.Audit.FirstAsync();

            actual.AuditId.Should().Be(audit.Id);
            actual.Date.Should().Be(audit.Date);
            actual.ComponentId.Should().Be(audit.ComponentId);
        }
        public async Task SaveAuditResultSavesKubeMetadata()
        {
            // Arrange
            await using var context = JosekiTestsDb.CreateUniqueContext();
            var parser = new ConfigurationParser("config.sample.yaml");
            var db     = new MssqlJosekiDatabase(context, parser);
            var audit  = new Audit
            {
                MetadataKube = new MetadataKube
                {
                    Date = DateTime.UtcNow,
                    JSON = Guid.NewGuid().ToString(),
                },
            };

            // Act & Assert
            context.MetadataKube.Should().HaveCount(0);
            await db.SaveAuditResult(audit);

            context.MetadataKube.Should().HaveCount(1);

            var actual = await context.MetadataKube.FirstAsync();

            actual.JSON.Should().Be(audit.MetadataKube.JSON);
            actual.Date.Should().Be(audit.MetadataKube.Date);
        }
        public async Task SaveAuditResultSavesCheckResults()
        {
            // Arrange
            await using var context = JosekiTestsDb.CreateUniqueContext();
            var parser = new ConfigurationParser("config.sample.yaml");
            var db     = new MssqlJosekiDatabase(context, parser);
            var audit  = new Audit
            {
                CheckResults = new List <CheckResult>
                {
                    new CheckResult {
                        InternalCheckId = 1, ComponentId = Guid.NewGuid().ToString(), Message = Guid.NewGuid().ToString(), Value = CheckValue.NoData
                    },
                    new CheckResult {
                        InternalCheckId = 2, ComponentId = Guid.NewGuid().ToString(), Message = Guid.NewGuid().ToString(), Value = CheckValue.Failed
                    },
                    new CheckResult {
                        InternalCheckId = 3, ComponentId = Guid.NewGuid().ToString(), Message = Guid.NewGuid().ToString(), Value = CheckValue.InProgress
                    },
                    new CheckResult {
                        InternalCheckId = 4, ComponentId = Guid.NewGuid().ToString(), Message = Guid.NewGuid().ToString(), Value = CheckValue.Succeeded
                    },
                },
            };

            // Act & Assert
            context.CheckResult.Should().HaveCount(0);
            await db.SaveAuditResult(audit);

            context.CheckResult.Should().HaveCount(4);

            var entities = await context.CheckResult.ToArrayAsync();

            foreach (var actual in entities)
            {
                var expected = audit.CheckResults.First(i => i.InternalCheckId == actual.CheckId);
                actual.ComponentId.Should().Be(expected.ComponentId);
                actual.Message.Should().Be(expected.Message);
                actual.Value.Should().Be(expected.Value.ToEntity());
            }
        }