public void InvokeWithFactoryMethodReturnsCorrectResult(Type targetType, int index, object values) { // Arrange var method = (from mi in targetType .GetMethods(BindingFlags.Static | BindingFlags.Public) where mi.ReturnType == targetType select mi).ElementAt(index); var sut = new StaticMethod(method); // Act var result = sut.Invoke((object[])values); // Assert Assert.IsAssignableFrom(targetType, result); }
public void InvokeWithFactoryMethodReturnsCorrectResult(Type targetType, int index, object values) { // Fixture setup var method = (from mi in targetType .GetMethods(BindingFlags.Static | BindingFlags.Public) where mi.ReturnType == targetType select mi).ElementAt(index); var sut = new StaticMethod(method); // Exercise system var result = sut.Invoke((object[])values); // Verify outcome Assert.IsAssignableFrom(targetType, result); // Teardown }