using System;
using System.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTestProject1
{
  [TestClass]
  public class UnitTest1
  {
    [TestMethod]
    public void TestMethod1()
    {
      var assembly = Assembly.LoadFile(Environment.CurrentDirectory + "\\ConsoleApplication1.exe");
      Type type = assembly.GetType("ConsoleApplication1.ReflectionClass");
      Assert.IsNotNull(type);

      object classInstance = Activator.CreateInstance(type, null);

      for (int i = 1; i <= 3; i++)
      {
        MethodInfo methodInfo = type.GetMethod(string.Format("ReflectionMethod{0}", i));
        Assert.IsNotNull(methodInfo);
        Assert.AreEqual(i, methodInfo.Invoke(classInstance, null));
        
        PropertyInfo propertyInfo = type.GetProperty(string.Format("ReflectionProperty{0}", i));
        Assert.IsNotNull(propertyInfo);
        Assert.AreEqual(i, propertyInfo.GetValue(classInstance, null));
      }
    }
  }
}
