Exemplo n.º 1
0
			public async Task WhenValidationRulesArePassedThenResultIsNotEmpty()
			{
				var solutionPath = @"..\..\..\ArchiMetrics.sln".GetLowerCaseFullPath();
				var rule = new BranchModelRule(new ModelNode("ArchiMetrics.Analysis", NodeKind.Assembly, CodeQuality.Good, 0, 0, 0));
				var result = await _validator.Validate(solutionPath, new[] { rule }, Enumerable.Empty<TransformRule>(), CancellationToken.None);

				CollectionAssert.IsNotEmpty(result);
			}
Exemplo n.º 2
0
			public async Task WhenTreeDoesNotContainBranchThenIsNotPassed()
			{
				var rule = new BranchModelRule(new ModelNode("cheese", "type", CodeQuality.Good, 0, 0, 0));
				var tree = new ModelNode("node", "type", CodeQuality.Good, 0, 0, 0, new[] { new ModelNode("child", "type", CodeQuality.Good, 0, 0, 0, new[] { new ModelNode("leaf", "type", CodeQuality.Good, 0, 0, 0) }) });

				var result = await rule.Validate(tree);

				Assert.IsFalse(result.Any(x => x.Passed));
			}
Exemplo n.º 3
0
			public async Task WhenTreeContainsComplexBranchThenIsPassed()
			{
				var rule = new BranchModelRule(new ModelNode("child", "type", CodeQuality.Good, 0, 0, 0, new[] { new ModelNode("leaf", "type", CodeQuality.Good, 0, 0, 0) }));
				var tree = new ModelNode("node", "type", CodeQuality.Good, 0, 0, 0, new[] { new ModelNode("child", "type", CodeQuality.Good, 0, 0, 0, new[] { new ModelNode("leaf", "type", CodeQuality.Good, 0, 0, 0) }) });

				var result = await rule.Validate(tree);

				Assert.IsTrue(result.All(x => x.Passed));
			}