summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/AssemblyTesting.cs
blob: 92b08ecbb29c015dc3b3e0bbd0715252155008a8 (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
//-----------------------------------------------------------------------
// <copyright file="AssemblyTesting.cs" company="Andrew Arnott">
//     Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.Test {
	using System.Diagnostics.Contracts;
	using NUnit.Framework;

	[SetUpFixture]
	public class AssemblyTesting {
		[SetUp]
		public static void AssemblyInitialize() {
			// Make contract failures become test failures.
			Contract.ContractFailed += (sender, e) => {
				// For now, we have tests that verify that preconditions throw exceptions.
				// So we don't want to fail a test just because a precondition check failed.
				if (e.FailureKind != ContractFailureKind.Precondition) {
					e.SetHandled();
					Assert.Fail(e.FailureKind.ToString() + ": " + e.Message);
				}
			};
		}
	}
}