public void IsNotNull_WhenValueIsNull_WritesTraceMessage() { var listener = new TestListener(); Trace.Listeners.Add(listener); var data = new FileData { StringValue = null }; Assert.Throws<ArgumentException>(() => data.IsNotNull()); Assert.AreEqual("Test:IsNotNullFailed:IsNotNull", listener.Output); Trace.Listeners.Remove(listener); }
public void DoesNotContainANumber_WhenStringDoesContainANumber_WritesTraceMessage() { var listener = new TestListener(); Trace.Listeners.Add(listener); var data = new FileData { StringValue = "1" }; Assert.Throws<ArgumentException>(() => data.DoesNotContainANumber()); Assert.AreEqual("Test:DoesNotContainANumberFailed:DoesNotContainANumber", listener.Output); Trace.Listeners.Remove(listener); }