I am new to unit testing and am using Visual Studio and I have a public variable in the form called mm_x
which is calculated in a function in the form (not in a class) and when I try to do a test I can't find a way to reference it from the UnitTest Method. It was easy to test other variables that are on classes but this particular one I can't find the best way to do it.
Should I:
Put all of the logic for the variable calculation in the form in a business class and then unit test the business class? Keep the form logic in the form and somehow unit test against the form?
As a reference, here's the method IN the form which contains the variable I'm trying to test: (poi_navegacion_individual and MR are 2 classes I use but I'm interested in teting the results of mm_X)
private void Leer_NDI_tracker(object sender, EventArgs e)
{
if (MR != null)
{
mm_X = poi_navegacion_individual.POR_x * Convert.ToDecimal(MR.MR0) + poi_navegacion_individual.POR_y * Convert.ToDecimal(MR.MR1) + poi_navegacion_individual.POR_z * Convert.ToDecimal(MR.MR2) + Convert.ToDecimal(MR.MR9);
}
}
Thank you,