Question:
I am trying to figure out if there is a way to compromise all C # unit tests whenever a particular condition is met.
BACKGROUND:
I set up unit test for an object that encodes and decodes its internal data. Here's a pretty far-fetched example:
[TestClass]
public class FooTests
{
private Foo TestFoo { get; set; }
[TestMethod]
public void DataEncodingIsWorking()
{
}
[TestMethod]
public void DataDecodingIsWorking()
{
}
public FooTests(dynamic[] data) {
TestFoo = new Foo(data);
}
}
public class Foo {
public void EncodeData() {
}
public void DecodeData() {
}
public Foo(dynamic[] data) {
}
}
Instead of creating a new instance TestFooin each [TestMethod](somewhat repetitive) I created a global object TestFooin FooTests. If the TestFooinstance could not be created, I expect that all the tags will not be able to execute FooTests(since encoding / decoding will not work if the object is not created).
, , . , unit test, , TestFoo.