public void MediumTrustThrowsSecurityExceptionWhenCopyingBetweenTypesFromDifferentModules() { Exception e1 = new Exception("my name is e1"); HttpException e2 = new HttpException("my name is e2"); // I know, I am a bit paranoid about that basic assumption Assert.AreNotEqual( e1.GetType().Assembly, e2.GetType().Assembly ); SecurityTemplate.MediumTrustInvoke(new ThreadStart(new CopyCommand(e2, e1).Execute)); Assert.AreEqual(e1.Message, e2.Message); }
public void Increment_WithHttpExceptionThatIsNot404_AddsStatusCodeToReadingName() { var sensor = new ExceptionSensor(); var exception = new HttpException(500, "Page not found"); sensor.AddError(exception); Reading reading = null; ReadingPublisher.Readings.TryDequeue(out reading); // TotalExceptions ReadingPublisher.Readings.TryDequeue(out reading); Assert.That(reading.Data.Name, Is.EqualTo(exception.GetHttpCode() + exception.GetType().Name )); }