I have a small application and 2 unit tests look for exceptions and so I have the decorator [ExpectedException(typeof(ArgumentException))] on them. When I run the tests individually everything is fine. If I run all, the 2 with the exception decorators will fail and the others succeed. If I run a group of tests where this 1 test that has the ExpectedException on it, that test will fail. The tests are really small and below are the 2 that have the exception decorator.
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void WrongArgCountExceptionThrown()
{
List<string> args = new List<string>
{
"-t",
"table_name",
"-d",
"2016-06-30"
};
Program prg = new Program();
prg.Run(args.ToArray(), new Data(logRepo.Object, queueRepo.Object));
}
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void WrongArgFormatExceptionThrown()
{
List<string> args = new List<string>
{
"t",
"table_name",
"-d",
"2016-06-30",
"-i",
"1"
};
Program prg = new Program();
prg.Run(args.ToArray(), new Data(logRepo.Object, queueRepo.Object));
}
Aucun commentaire:
Enregistrer un commentaire