private static void VerifyTargets(XBuild expectedBuild, Build actualBuild) { var expectedTargets = expectedBuild.Targets.Target; var expectedTargetNames = expectedBuild.Targets.Target.Select(t => t.Name); var actualTargets = actualBuild.Targets; actualTargets.Should().NotBeNull(); actualTargets.Should().NotBeEmpty().And.HaveCount(expectedTargets.Count); actualTargets.Should().OnlyContain(aTarget => aTarget.Name.IsIn(expectedTargetNames) && aTarget.Build.IsNotNull() && aTarget.Metrics.IsNotNullOrEmpty()); VerifyModules(expectedTargets, actualTargets); }
private static void VerifyBuild( XBuild expectedBuild, InMemoryMetricsStore fakeMetricsStore, string expectedBuildName) { var actualBuilds = fakeMetricsStore.Builds; actualBuilds.Should().NotBeNull().And.HaveCount(1); actualBuilds.Should().OnlyContain(aBuild => aBuild.Name.Equals(expectedBuildName) && aBuild.Metrics.IsNotNullOrEmpty()); Build actualBuild = actualBuilds.First(); actualBuild.Should().NotBeNull(); VerifyTargets(expectedBuild, actualBuild); }
public async Task Import(XBuild metricsXmlData, string buildName) { var build = new Build { Name = buildName, Targets = new List<Target>() }; CreateTargets(build, metricsXmlData.Targets.Target); UpdateBuildMetrics(build); _metricsStore.Builds.Add(build); await _metricsStore.SaveChangesAsync(); }