public void AddAssemblyWithCriteria() { // Arrange var repository = new WeightedTypeRepository(); var criteria = new WeightedTypeCriteria<Type> { Match = (type) => { if (type == typeof(MockType)) { return true; } return false; } }; // Act repository.AddAssembly(typeof(MockType).Assembly, criteria); var methods = new List<MethodInfo>(repository.GetMethods(typeof(int))); // Assert Assert.AreEqual(3, methods.Count); }
public void AddTypeWithMatchCriteria_GetMethodBack() { // Arrange var repository = new WeightedTypeRepository(); var criteria = new WeightedTypeCriteria<MethodInfo> { Match = (method) => { if (method.Name == "Method3") { return true; } return false; } }; // Act repository.AddType(typeof(MockType), criteria); var methods = new List<MethodInfo>(repository.GetMethods(typeof(int))); // Assert Assert.AreEqual(1, methods.Count); Assert.AreEqual("Method3", methods[0].Name); }