Skip to content

Instantly share code, notes, and snippets.

@sebmaldo
Created September 25, 2013 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebmaldo/6694227 to your computer and use it in GitHub Desktop.
Save sebmaldo/6694227 to your computer and use it in GitHub Desktop.
[TestMethod]
public void ProbandoSumadorEstaticoPrivado()
{
//Se crea una clase PriveteType que envuelve a la clase Matemática
//para luego poder invocar su método estático privado
var privateTest = new PrivateType(typeof(Matematica));
//Se utiliza el método invocar estático para invocar y su resultado
//se almacena en la variable obj
object obj = privateTest.InvokeStatic("SumaNumeros", 1, 4);
//Se testea el retorno del método en el objeto obj.
Assert.AreEqual(10, (int) obj);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment