public void Test_IfDoesNotThrowExecptionIfProviderDllsExist() { File.WriteAllText(expectedDll, ""); var validator = new DependencyValidator(options, logger); validator.Validate(); }
public void Test_IfDoesNotThrowExecptionIfBothOfTheDllsExist() { File.WriteAllText(interceptorDll, ""); File.WriteAllText(kerberosDll, ""); var validator = new DependencyValidator(Path.Combine(Environment.CurrentDirectory, "assembly")); validator.Validate(); }
public void Test_IfThrowsExecptionIfRedisSessionStateProviderIsMissing() { File.WriteAllText(expectedDll, ""); File.Delete(expectedDll); var validator = new DependencyValidator(options, logger); Assert.Throws <Exception>(() => validator.Validate()); }
public void Test_IfThrowsExecptionIfGssKerberosIsMissing() { File.WriteAllText(interceptorDll, ""); File.WriteAllText(kerberosDll, ""); File.Delete(kerberosDll); var validator = new DependencyValidator(Path.Combine(Environment.CurrentDirectory, "assembly")); Assert.Throws <Exception>(() => validator.Validate()); }
public void ValidateDependencies_CircularDependencies_Fails() { var values = new Dictionary <string, IEnumerable <string> > { { "c", new string[] { } }, { "x", new string[] { "y" } }, { "y", new string[] { "c", "z" } }, { "z", new string[] { "x" } }, }; Assert.That.Throws <DynamicException>(() => DependencyValidator.ValidateDependencies(values), filter => filter.When(name: "CircularDependencyException")); }
//[ExpectedException(typeof(CircularDependencyException))] public void ValidateDependencies_ValidDependencies_Passes() { var values = new Dictionary <string, IEnumerable <string> > { { "c", new string[] { } }, { "x", new string[] { "y" } }, { "y", new string[] { "c", "z" } }, { "z", new string[] { "c" } }, }; DependencyValidator.ValidateDependencies(values); }
public void ValidateDependencies_MissingDependencies_Fails() { var values = new Dictionary <string, IEnumerable <string> > { { "c", new string[] { } }, { "x", new string[] { "y" } }, { "y", new string[] { "c", "z" } }, { "z", new string[] { "a" } }, }; DependencyValidator.ValidateDependencies(values); Assert.That.ThrowsExceptionFiltered <DynamicException>(() => DependencyValidator.ValidateDependencies(values), ex => ex.NameEquals("MissingDependencyException")); }
public void IsAllowedDependency_WithMatchingAllowedRule_ReturnsTrue() { // arrange var settings = new DependencyCopSettings { Rules = new[] { new DependencyRuleEntry { Type = DependencyRuleType.Allow, From = "*", To = "Foo.Pilot" } } }; var validator = new DependencyValidator(settings); // act bool actual = validator.IsAllowedDependency(new Namespace("Foo.Bar"), new Namespace("Foo.Pilot")); // assert Assert.True(actual); }
public static string FormatAll(this string text, IDictionary <string, object> data, IFormatProvider formatProvider = null) { if (string.IsNullOrEmpty(text)) { return(text); } if (data == null) { throw new ArgumentNullException(nameof(data)); } formatProvider = formatProvider ?? new DefaultFormatter(); var dependencies = data.ToDictionary(x => x.Key, x => GetNames(string.Format(formatProvider, "{0}", x.Value))); DependencyValidator.ValidateDependencies(dependencies); while (text.ToString() != (text = text.Format(data, formatProvider))) { ; } return(text); }
public void SetUp() { _validator = new DependencyValidator(); }