So I am having a few issues with my unit Tests, I cant just copy and past them here but I will give what I can.
The problem seems to be that if I run the tests one by one everything works as intended, but if I tell it to run the tests all together 1/5 will pass,
[TestMethod]
public void ObjTest()
{
//Arrange - multiple ecus and items
var t = new var();
t.itemNumbers = new List<ItemNumber>();
obj e = new obj();
e.property = "(12345 OR 55555) AND !65232";
Globals.masterList.Add(e);
ItemNumber i = new ItemNumber();
i.num= "12345";
ItemNumber i1 = new ItemNumber();
i1.num= "55555";
ItemNumber i2 = new ItemNumber();
i2.num= "55556";
t.itemNumbers.Add(i);
t.itemNumbers.Add(i1);
t.itemNumbers.Add(i2);
ICollection<Iinterface> tmp = new List<Iinterface>();
//act, process the ecu and item lists
;
functionCalled(t.itemNumbers, Globals.masterList, ref tmp);
//assert, there should be only 2 added to the list
Assert.AreEqual(1, tmp.Count, " ");
Assert.AreEqual("(12345 OR 55555) AND !65232", functionCalled(t.itemNumbers, Globals.masterList, ref tmp), "Wrong obj returned.");
}
All of the unit tests are basically a copy and past with the chages to e.property and possibly a change to one of the i numbers,
the tests are designed to check edge cases cased by user input.
is there something I am missing to ensure scope clears all of the variables and everything between tests. or force serial execution.