summaryrefslogtreecommitdiffstats
path: root/tools/NUnit/samples/csharp/failures
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-07-21 16:15:28 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2010-07-21 16:15:28 -0700
commitd2350db627b5ef7c9ebe6fd150b3007b0af1e660 (patch)
tree6817d8679ad3efadb78e7c275429fd9372ee4058 /tools/NUnit/samples/csharp/failures
parentb5c8335f528acbca046ca2844f8e4c12cfa9cba3 (diff)
parent4f2ccab7a53819c7d0c4008626995e95ece4dd34 (diff)
downloadDotNetOpenAuth-d2350db627b5ef7c9ebe6fd150b3007b0af1e660.zip
DotNetOpenAuth-d2350db627b5ef7c9ebe6fd150b3007b0af1e660.tar.gz
DotNetOpenAuth-d2350db627b5ef7c9ebe6fd150b3007b0af1e660.tar.bz2
Merge branch 'v3.4' into oauth2
Conflicts: projecttemplates/RelyingPartyDatabase/RelyingPartyDatabase.dbproj projecttemplates/RelyingPartyLogic/CreateDatabase.sql samples/OAuthConsumerWpf/OAuthConsumerWpf.csproj src/DotNetOpenAuth.Test/Messaging/MessagingUtilitiesTests.cs src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs src/DotNetOpenAuth/Messaging/MessagingStrings.resx src/DotNetOpenAuth/Messaging/MessagingUtilities.cs src/DotNetOpenAuth/OAuth/ChannelElements/OAuthChannel.cs src/version.txt
Diffstat (limited to 'tools/NUnit/samples/csharp/failures')
-rw-r--r--tools/NUnit/samples/csharp/failures/AssemblyInfo.cs58
-rw-r--r--tools/NUnit/samples/csharp/failures/CSharpTest.cs85
-rw-r--r--tools/NUnit/samples/csharp/failures/cs-failures.build11
-rw-r--r--tools/NUnit/samples/csharp/failures/cs-failures.csproj20
4 files changed, 174 insertions, 0 deletions
diff --git a/tools/NUnit/samples/csharp/failures/AssemblyInfo.cs b/tools/NUnit/samples/csharp/failures/AssemblyInfo.cs
new file mode 100644
index 0000000..67e65b0
--- /dev/null
+++ b/tools/NUnit/samples/csharp/failures/AssemblyInfo.cs
@@ -0,0 +1,58 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("csharp.sample.dll")]
+[assembly: AssemblyDescription("C# Sample Unit Tests")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("NUnit")]
+[assembly: AssemblyProduct("NUnit")]
+[assembly: AssemblyCopyright("Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov. \nCopyright (C) 2000-2003 Philip Craig.\nAll Rights Reserved.")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("2.2.0.0")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
diff --git a/tools/NUnit/samples/csharp/failures/CSharpTest.cs b/tools/NUnit/samples/csharp/failures/CSharpTest.cs
new file mode 100644
index 0000000..0ab0fe6
--- /dev/null
+++ b/tools/NUnit/samples/csharp/failures/CSharpTest.cs
@@ -0,0 +1,85 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Samples
+{
+ using System;
+ using NUnit.Framework;
+
+ /// <summary>Some simple Tests.</summary>
+ ///
+ [TestFixture]
+ public class SimpleCSharpTest
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ protected int fValue1;
+ /// <summary>
+ ///
+ /// </summary>
+ protected int fValue2;
+
+ /// <summary>
+ ///
+ /// </summary>
+ [SetUp] public void Init()
+ {
+ fValue1= 2;
+ fValue2= 3;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ ///
+ [Test] public void Add()
+ {
+ double result= fValue1 + fValue2;
+ // forced failure result == 5
+ Assert.AreEqual(6, result, "Expected Failure.");
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ ///
+ [Test] public void DivideByZero()
+ {
+ int zero= 0;
+ int result= 8/zero;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ ///
+ [Test] public void Equals()
+ {
+ Assert.AreEqual(12, 12, "Integer");
+ Assert.AreEqual(12L, 12L, "Long");
+ Assert.AreEqual('a', 'a', "Char");
+ Assert.AreEqual((object)12, (object)12, "Integer Object Cast");
+
+ Assert.AreEqual(12, 13, "Expected Failure (Integer)");
+ Assert.AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double).");
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void ExpectAnException()
+ {
+ throw new InvalidCastException();
+ }
+
+ [Test]
+ [Ignore("ignored test")]
+ public void IgnoredTest()
+ {
+ throw new Exception();
+ }
+ }
+} \ No newline at end of file
diff --git a/tools/NUnit/samples/csharp/failures/cs-failures.build b/tools/NUnit/samples/csharp/failures/cs-failures.build
new file mode 100644
index 0000000..ea71419
--- /dev/null
+++ b/tools/NUnit/samples/csharp/failures/cs-failures.build
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<project name="cs-failures" default="build">
+
+ <include buildfile="../../samples.common"/>
+
+ <patternset id="source-files">
+ <include name="AssemblyInfo.cs" />
+ <include name="CSharpTest.cs" />
+ </patternset>
+
+</project> \ No newline at end of file
diff --git a/tools/NUnit/samples/csharp/failures/cs-failures.csproj b/tools/NUnit/samples/csharp/failures/cs-failures.csproj
new file mode 100644
index 0000000..e66e6d4
--- /dev/null
+++ b/tools/NUnit/samples/csharp/failures/cs-failures.csproj
@@ -0,0 +1,20 @@
+<VisualStudioProject>
+ <CSHARP ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{15D66EEE-A852-4A52-89C2-83E74ECF3770}">
+ <Build>
+ <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="cs-failures" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" PreBuildEvent="" PostBuildEvent="" RootNamespace="csharp_sample" RunPostBuildEvent="OnBuildSuccess" StartupObject="">
+ <Config Name="Debug" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="DEBUG;TRACE" DocumentationFile="" DebugSymbols="true" FileAlignment="4096" IncrementalBuild="true" NoStdLib="false" NoWarn="" Optimize="false" OutputPath="bin\Debug\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4" />
+ <Config Name="Release" AllowUnsafeBlocks="false" BaseAddress="285212672" CheckForOverflowUnderflow="false" ConfigurationOverrideFile="" DefineConstants="TRACE" DocumentationFile="" DebugSymbols="false" FileAlignment="4096" IncrementalBuild="false" NoStdLib="false" NoWarn="" Optimize="true" OutputPath="bin\Release\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="4" />
+ </Settings>
+ <References>
+ <Reference Name="System" AssemblyName="System" />
+ <Reference Name="nunit.framework" AssemblyName="nunit.framework, Version=2.5, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" HintPath="..\..\..\bin\net-1.1\framework\nunit.framework.dll" />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File RelPath="AssemblyInfo.cs" SubType="Code" BuildAction="Compile" />
+ <File RelPath="CSharpTest.cs" SubType="Code" BuildAction="Compile" />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject> \ No newline at end of file