summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/AssemblyTesting.cs
blob: bfce6c687489a880bb08c7a1abd1eb014297fe33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//-----------------------------------------------------------------------
// <copyright file="AssemblyTesting.cs" company="Andrew Arnott">
//     Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.Test {
	using System.Diagnostics.Contracts;
	using Microsoft.VisualStudio.TestTools.UnitTesting;

	[TestClass]
	public class AssemblyTesting {
		[AssemblyInitialize]
		public static void AssemblyInitialize(TestContext tc) {
			// Make contract failures become test failures.
			Contract.ContractFailed += (sender, e) => {
				if (e.FailureKind == ContractFailureKind.Precondition) {
					// Currently we ignore these so that the regular ErrorUtilities can kick in.
					e.Handled = true;
				} else {
					e.Handled = true;
					Assert.Fail(e.FailureKind.ToString() + ": " + e.DebugMessage);
				}
			};
		}
	}
}