This commit is contained in:
Sebastien Pouliot 2013-10-04 15:48:45 -04:00
Родитель 2ab9233730
Коммит fd4a3605e8
520 изменённых файлов: 71629 добавлений и 0 удалений

Двоичные данные
NUnitLite-1.0.0/.DS_Store поставляемый Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,12 @@
build
bin
obj
*.suo
*.vssscc
*.vspscc
*.csproj.user
*.pidb
*.userprefs
package
TestResults
_TEMP.nuspec

400
NUnitLite-1.0.0/CHANGES.txt Normal file
Просмотреть файл

@ -0,0 +1,400 @@
NUnitLite Version 1.0 - September 13, 2013
Bug Fixes
* 1221712 When non-existing test method is specified in -test, result is still "Tests run: 1, Passed 1"
* 1223294 System.NullReference thrown when ExpectedExceptionAttribute is used in a static class
NUnitLite Version 1.0 Beta 2 - August 17, 2013
Attributes
* The TimeoutAttribute is now avaialable under the Compact Famework.
Constraints
* The DelayedConstraint and its associated 'After' syntax are now
available under the Compact Framework.
Bug Fixes
* 1071343 Runner.Load fails on compact framework if the test assembly contains a generic method
* 1203361 Randomizer uniqueness tests sometimes fail
* 1212890 The /seed option value is not being used to generate tests
* 1213174 Implement TimeoutAttribute for the compact framework builds
* 1213176 Compact framework and Silverlight builds should use the document folder
* 1213180 Split Compact frameowork 2.0 and 3.5 builds into separate solutions
* 1213451 Implement DelayedConstraint for the compact framework builds
NUnitLite Version 1.0 Beta 1 - July 28, 2013
Runner
* The build-in runner now accepts a -seed option, which may be used to
set the seed for random arguments as well as for use by TestContext.Random.
By setting the seed to the value used in a prior run, the same sequence
of random values will be used in the current run, provided the tests
have not been changed in any way between runs.
Bug Fixes
* 1111838 Include Random Seed in Test Report
* 1182634 TestContext.Random.GetEnm isn't generic in .NET 4
* 1183582 Add -seed /seed Command Line Option
* 1203360 Tests under Ignored fixtures are not reported
* 1203959 Resolve level of Silverlight support for the release
* 1203961 Review and revise XML format for release
NUnitLite Version 0.9 - May 5, 2013
Framework
* A .NET 4.5 build is included. When using the 4.5 package,
C# 5.0 async methods may be used as tests, as the target of
a Throws constraint and as an ActualValueDelegate returning
the value to be tested.
* Experimental builds for Silverlight 3.0, 4.0 and 5.0 are included.
* TestContext.Random may be used to provide random values of various
types for use in your tests.
* The experimental Asynchronous attribute has been removed.
Runner
* The runner now supports the -include and -exclude options, which
are used to specify categories of tests to be included in a run.
* Test execution time is now reported at a higher resolution on
systems that support it.
Bug Fixes
* 501784 Theory tests do not work correctly when using null parameters
* 671432 Upgrade NAnt to Latest Release
* 1028188 Add Support for Silverlight
* 1029785 Test loaded from remote folder failed to run with exception System.IO.Directory Not Found
* 1057981 C#5 async tests are not supported
* 1060631 Add .NET 4.5 build
* 1064014 Simple async tests should not return Task<T>
* 1071164 Support async methods in usage scenarios of Throws constraints
* 1071714 TestContext is broken when a previous version of the runner is used alongside a new version of the framework
* 1071861 Error in Path Constraints
* 1072379 Report test execution time at a higher resolution
* 1073750 Remove Asynchronous Attribute
* 1074568 Assert/Assume should support an async method for the ActualValueDelegate
* 1082330 Better Exception if SetCulture attribute is applied multiple times
* 1111834 Expose Random Object as part of the test context
* 1172979 Add Category Support to nunitlite Runner
* 1174741 sl-4.0 csproj file is corrupt
NUnitLite Version 0.8 - September 13, 2012
Runner
* The runner now displays the framework version for which it
was built in the header, in addition to the framework under
which it is currently running.
* The new -explore option will list all the tests to a file
in XML format, without running them.
* The runner now supports the -test option, which allows
selecting specific tests to be executed.
Attributes
* The new AsynchronousAttribute marks test methods that are
to be run asynchronously. An asynchronous test runs on a
separate thread and continues to run to completion while
other tests run. Asynchronous tests must be written to
avoid accessing common data, which may be changed by
other tests.
* RandomAttribute can now provide random enumeration data
* PlatformAttribute now recognizes MacOsX, Xbox and MonoTouch
* The following attributes from full NUnit are now supported
by NUnitLite:
DataPoint
DataPoints
Theory
Timeout
Value
ValueSource
Constraints
* The following constraints from full NUnit are now supported
by NUnitLite:
DelayedConstraint
ExactCountConstraint
PredicateConstraint
ReusableConstraint
* New Syntax Helpers are supported in conjunction with the
above constraints:
After
Exactly
Matching
Bug Fixes
* 999133 Comments in Program.cs document non-existing classes
* 999136 NUGet adds all three assemblies to the project
* 999137 result:path missing filename could use better error report
* 1000213 Inconclusive message Not in report output
* 1020295 add v2 results output for continuous integration server support
* 1023003 -explore does not work unless a path is specified
* 1023084 Add Enum support to RandomAttribute
* 1023673 -test:<testName> argument does not work
* 1028181 TextUi class does not make use of TextWriter passed to constructor
* 1028252 Implement PredicateConstraint in NUnitLite
* 1028253 Implement Theories in NUnitLite
* 1029170 Implement ReusableConstraint in NUnitLite
* 1029216 Implement ExactCountConstraint in NUnitLite
* 1037144 Add MonoTouch support to PlatformAttribute
* 1041365 Add MaxOsX and Xbox support to platform attribute
* 1047585 Add Asynchronous attribute
NUnitLite Version 0.7 - May 11, 2012
This release brings NUnitLite to a point where it is functionally
equivalent to the NUnit 3.0 build of NUnitLite and has most of the
same capabilities as the full version of NUnit.
Obsolete methods and classes have been removed and the code has been
reorganized to facilitate code sharing with NUnit 3.0.
NUnitLite is now built for the desktop using Visual Studio 2010. A VS 2008 project is still used for the compact framework builds.
Separate builds are now created for .NET 2.0, 3.5 and 4.0
A nuspec file is now provided and NUnitLite is distributed under NuGet.
New Features and Enhancements
* An An XML result file may be saved using the --result option of the runner.
* The --explore option will create a list of tests contained in the assembly.
* The --out option allows redirecting the final result to a report file. It must be used when running the test on a device without a Console.
* Assume.That is now supported
* ExpectedExceptionAttribute now supports the same properties as for full NUnit.
* New Constraints
EmptyDirectoryConstraint
ExceptionTypeConstraint
* New Asserts
ByVal
Throws
DoesNotThrow
Catch
AreEqual
AreNotEqual
AreSame
AreNotSame
* New Syntax Helpers:
Is: Positive
Negative
Has: Exactly
* New Attributes
CategoryAttribute
CombinatorialAttribute
CultureAttribute
DataAttribute
ExplicitAttribute
IncludeExcludeAttribute
MaxTimeAttribute
NUnitAttribute
PairwiseAttribute
PlatformAttribute
RandomAttribute
RangeAttribute
RepeatAttribute
SequentialAttribute
SetCultureAttribute (not available on compact framework)
SetUICultureAttribute (not available on compact framework)
TestCaseAttribute
TestCaseSourceAttribute
TestFixtureSetUpAttribute
TestFixtureTearDownAttribute
TestModificationAttribute
ValueSourceAttribute
ValuesAttribute
Bug Fixes
* 554633 NUnitLite.csproj doesn't have required constants for Release
* 742473 Assert.Pass is treated as a test failure
* 742625 TestLoader.Load fails when run under Unity's web-player
* 996055 NUnitLite runner should allow redirecting output via command line
* 996059 Need a VS project for compact framework
NUnitLite Version 0.6 - January 13, 2010
This is the first release of NUnitLite under the MIT license.
New Features and Enhancements
* New Asserts
Pass
Ignore
Inconclusive
* New Syntax Helpers:
Throws: InnerException
InvalidOperationException
ArgumentException
TargetInvocationException
Has: InnerException
ConstraintExpression:
BinarySerializable
XmlSerializable
ContainsSubstring
StartsWith
EndsWith
Matches
Bug fixes:
* Additional control characters are now escaped in message output
* A Stream now compares correctly as equal to itself
NUnitLite Version 0.5 - June 14, 2009
This is the first release from our new Launchpad.net project
and aims at improved compatibility with NUnit 2.5.
New Features and Enhancements
* New Constraints:
AssignableToConstraint
AttributeConstraint
AttributeExistsConstraint,
BinarySerializableConstraint (not available on compact framework)
CollectionOrderedConstraint
EmptyCollectionConstraint
EmptyStringConstraint
EqualConstraint
FalseConstraint
NaNConstraint
NullConstraint
NullOrEmptyStringConstraint
RangeConstraint
SamePathConstraint
SamePathOrUnderConstraint
ThrowsConstraint
ThrowsNothingConstraint
TrueConstraint
XmlSerializableConstraint (not available on compact framework 1.0)
* New Syntax Helpers
Is: AssignableTo
BinarySerializable (not available on compact framework)
TypeOf (replacing Type)
InRange
InstanceOf (replacing InstanceOfType)
Ordered
SamePath
SamePathOrUnder
XmlSerializable (not available on compact framework 1.0)
Has: Attribute
Message
----------------------------------------------------------------------------
NUnitLite Version 0.2 - November 3, 2007
New Features and Enhancements
* New attributes: PropertyAttribute, DescriptionAttribute, IgnoreAttribute
* Text runner output may now be redirected (issue 12449)
* Added VS solution for building under the compact framework (issue 14447)
* Solutions are no longer bound to Source Control and anonymous access is now possible using several clients
Bug fixes:
* Fixed incorrect preprocessor constants (12361, 12411)
* Fixed StackFilter to use correct namespace (12372)
* Expected Exception is now handled corretly on Compact Framework (1446)
----------------------------------------------------------------------------
NUnitLite Version 0.1 - August 20, 2007
The initial release of NUnitLite includes the following features:
* Builds and runs on .NET 1.0, 1.1 and 2.0, .NET CF 1.0 and 2.0 and Mono 1.0 and 2.0 profiles. Since only a console runner is provided, it is not yet possible to run on devices that do not include a console.
* Attributes recognized:
TestFixtureAttribute
TestAttribute
SetUpAttribute
TearDownAttribute
ExpectedExceptionAttribute
* Tests may be identified by inheritance from TestCase or using attributes.
* Assert methods:
Assert.Null
Assert.NotNull
Assert.True
Assert.False
Assert.Fail
Assert.That
* Constraint classes (excluding abstract classes):
AllItemsConstraint
AndConstraint
AssignableFromConstraint
CollectionContainsConstraint
CollectionEquivalentConstraint
CollectionSubsetConstraint
ContainsConstraint
EmptyConstraint
EndsWithConstraint
ExactTypeConstraint
GreaterThanConstraint
GreaterThanOrEqualConstraint
InstanceOfTypeConstraint
LessThanConstraint
LessThanOrEqualConstraint
NoItemConstraint
NotConstraint
OrConstraint
PropertyConstraint
RegexConstraint (not available on compact framework)
SameAsConstraint
SomeItemsConstraint
StartsWithConstraint
SubstringConstraint
UniqueItemsConstraint
* Syntax helpers:
Is: Not, All, Null, True, False, NaN, Empty, Unique, EqualTo, SameAs,
GreaterThan, GreaterThanOrEqualTo, LessThan, LessThanOrEqualTo,
AtLeast, AtMost, Type, InstanceOfType, AssignableFrom, StringContaining,
StringStarting, StringEnding, StringMatching (except compact framework),
EquivalentTo, SubsetOf
Contains: Substring, Item
Has: No, All, Some, None,Property, Length, Count, Member

Просмотреть файл

@ -0,0 +1,20 @@
Copyright (c) 2004-2013 Charlie Poole
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

31
NUnitLite-1.0.0/NOTES.txt Normal file
Просмотреть файл

@ -0,0 +1,31 @@
General notes for developers working on NUnitLite:
1. NUnitLite is built for .NET 1.1, 2.0, 3.5 and 4.0, .NET
CF 2.0 and 3.5 and Silverlight 3.0, 4.0 and 5.0. The VS 2010
project builds .NET 2.0, 3.5 and 4.0 aswell as the Silverlight
builds. The VS2012 project builds .NET 2.0, 3.5, 4.0 and 4.5
and Silverlight 4.0 and 5.0. There are also VS 2008 projects
project for testing under CF 2.0 and 3.5. The NAnt script
builds all the targets, provided you have them installed.
For example, use 'nant net-1.1 build' or 'nant build-all'.
2. Avoid use of generics, lambdas, etc and use conditional
compilation where they are necessary. It's usually simpler
to use .NET 1.x compatible code in the framework itself.
In the tests, it's necessary to use conditional compilation
in order to make sure that things like lambdas work. The
next release of NUnitLite will only support .NET 2.0 and
higher, making things somewhat easier.
3. It may seem strange to find conditional code contained in
these projects based on the definition of NUNITLITE. This is
done to keep the code consistent with NUnit 3.0, which uses
the same codebase for both NUnit and NUnitLite.
4. NUnitLite's runner, being in the same assembly with the
framework, is able to access internal definitions, which
are not available to the NUnit runner. For example, the
NUnitLite runner uses all the filter types directly, while
NUnit's console runner must construct an XML representation
of the filters to pass to the framework.

Просмотреть файл

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>NUnitLite</id>
<version>${package.version}${package.suffix}</version>
<authors>Charlie Poole</authors>
<owners>Charlie Poole</owners>
<licenseUrl>http://nunit.org/nuget/nunitlite-license.txt</licenseUrl>
<projectUrl>http://nunitlite.org</projectUrl>
<iconUrl>http://nunit.org/nuget/nunit_32x32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>NUnitLite is a lightweight testing framework for .NET, based on NUnit.</summary>
<description>NUnitLite provides a subset of the features of NUnit, uses minimal resources and runs on resource-restricted platforms used in embedded and mobile development. This packaage contains builds of NUnitLite for .NET 2.0, 3.5, 4.0 and 4.5 as well as Silverlight 5.0.&#10;&#13;How to use this package:&#10;&#13;1. Create a console application for your tests and delete the generated class containing Main().&#10;&#13;2. Install the NUnitLite package, which creates a new Main() as well as adding a reference to NUnitLite.&#10;&#13;3. Add your tests to the test project and start the project to execute them.</description>
<copyright>Copyright (c) 2004-2012 Charlie Poole</copyright>
<language>en-US</language>
<tags>test testing tdd framework fluent assert device phone compact embedded</tags>
</metadata>
<files>
<file src="LICENSE.txt" />
<file src="README.txt" />
<file src="CHANGES.txt" />
<file src="package\${package.base.name}\net-4.5\nunitlite.dll" target="lib/net45" />
<file src="package\${package.base.name}\net-4.5\nunitlite.xml" target="lib/net45" />
<file src="package\${package.base.name}\net-4.0\nunitlite.dll" target="lib/net40" />
<file src="package\${package.base.name}\net-4.0\nunitlite.xml" target="lib/net40" />
<file src="package\${package.base.name}\net-3.5\nunitlite.dll" target="lib/net35" />
<file src="package\${package.base.name}\net-3.5\nunitlite.xml" target="lib/net35" />
<file src="package\${package.base.name}\net-2.0\nunitlite.dll" target="lib/net20" />
<file src="package\${package.base.name}\net-2.0\nunitlite.xml" target="lib/net20" />
<file src="package\${package.base.name}\silverlight-5.0\nunitlite.dll" target="lib/sl50" />
<file src="package\${package.base.name}\silverlight-5.0\nunitlite.xml" target="lib/sl50" />
<file src="src\tests\Program.cs" target="content" />
</files>
</package>

Просмотреть файл

@ -0,0 +1,411 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-2.0", "src\framework\nunitlite-2.0.csproj", "{C24A3FC4-2541-4E9C-BADD-564777610B75}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-2.0", "src\tests\nunitlite.tests-2.0.csproj", "{C8FA4073-B24E-4178-93A1-5E1256C8B528}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestResultConsole", "src\TestResultConsole\TestResultConsole.csproj", "{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-2.0", "src\testdata\nunitlite.testdata-2.0.csproj", "{442DAB16-3063-4FE3-90B6-C29C3D85360D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NET-2.0", "NET-2.0", "{A466054B-B601-46A2-8D7B-03DE10A94F09}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NET-3.5", "NET-3.5", "{08B11E56-AB8C-4374-8709-45631094B29B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NET-4.0", "NET-4.0", "{D0ED3F4D-113E-4858-8042-C657CAC0CF46}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-3.5", "src\framework\nunitlite-3.5.csproj", "{43B24DC5-16D6-45EF-93F1-B021B785A892}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-3.5", "src\testdata\nunitlite.testdata-3.5.csproj", "{652AFEEB-B19C-4C67-A014-2248EA72F229}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-3.5", "src\tests\nunitlite.tests-3.5.csproj", "{94A4E298-F324-4531-856F-127505F766E5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-4.0", "src\framework\nunitlite-4.0.csproj", "{1567BCCE-7BE9-4815-84D7-7F794DB39081}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-4.0", "src\testdata\nunitlite.testdata-4.0.csproj", "{5C77A144-3CD1-42FC-B622-410E1945CA1E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-4.0", "src\tests\nunitlite.tests-4.0.csproj", "{497A578E-EF93-4190-96E0-B7F22E08027B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{601BC853-DE7B-47EB-A92B-AEDE16A17FCF}"
ProjectSection(SolutionItems) = preProject
CHANGES.txt = CHANGES.txt
LICENSE.txt = LICENSE.txt
NOTES.txt = NOTES.txt
nunitlite.build = nunitlite.build
nunitlite.build.include = nunitlite.build.include
NUnitLite.nuspec = NUnitLite.nuspec
nunitlite.projects.common = nunitlite.projects.common
NUnitLiteCF.nuspec = NUnitLiteCF.nuspec
README.txt = README.txt
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-2.0", "src\mock-assembly\mock-assembly-2.0.csproj", "{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-3.5", "src\mock-assembly\mock-assembly-3.5.csproj", "{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-4.0", "src\mock-assembly\mock-assembly-4.0.csproj", "{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SL-4.0", "SL-4.0", "{B4F52628-112A-4C09-A597-2DC7B5AEE818}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-sl-4.0", "src\framework\nunitlite-sl-4.0.csproj", "{41326141-EB24-4984-9D9B-5CFAA55946BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-sl-4.0", "src\mock-assembly\mock-assembly-sl-4.0.csproj", "{3C1249FC-B5DF-4E3A-ADDD-817526254876}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-sl-4.0", "src\testdata\nunitlite.testdata-sl-4.0.csproj", "{E97412B5-8C91-4236-8E9A-24C8E20BC675}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-sl-4.0", "src\tests\nunitlite.tests-sl-4.0.csproj", "{0B899C26-9114-440A-A8A1-615CDE7EE6BD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SL-5.0", "SL-5.0", "{AEB97450-F9CF-4CF4-90D0-6CD5EDAB8588}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-sl-5.0", "src\framework\nunitlite-sl-5.0.csproj", "{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-sl-5.0", "src\mock-assembly\mock-assembly-sl-5.0.csproj", "{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-sl-5.0", "src\testdata\nunitlite.testdata-sl-5.0.csproj", "{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-sl-5.0", "src\tests\nunitlite.tests-sl-5.0.csproj", "{7107C352-7F42-497E-A26C-25E9AAE8E54C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SL-3.0", "SL-3.0", "{035EFB6B-82E9-4510-AC99-B586E6381B25}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-sl-3.0", "src\framework\nunitlite-sl-3.0.csproj", "{02B02379-2596-4E45-8B10-835D62EA2D9E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-sl-3.0", "src\mock-assembly\mock-assembly-sl-3.0.csproj", "{BB355D2C-FB4F-4526-9B40-7944C40FDFDA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-sl-3.0", "src\testdata\nunitlite.testdata-sl-3.0.csproj", "{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-sl-3.0", "src\tests\nunitlite.tests-sl-3.0.csproj", "{FFEA1F81-9631-43A8-8368-FBC14B1E7B02}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ci-test-runner-sl-5.0", "src\runner\ci-test-runner-sl-5.0.csproj", "{71848958-61FC-49B1-986B-CD824F9C3D9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ci-test-runner-sl-4.0", "src\runner\ci-test-runner-sl-4.0.csproj", "{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ci-test-runner-sl-3.0", "src\runner\ci-test-runner-sl-3.0.csproj", "{AA4E9904-77D0-406B-A50C-A0508DDB56A7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Debug|x86.ActiveCfg = Debug|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Release|Any CPU.Build.0 = Release|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Release|x86.ActiveCfg = Release|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Debug|x86.ActiveCfg = Debug|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Release|Any CPU.Build.0 = Release|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Release|x86.ActiveCfg = Release|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Debug|x86.ActiveCfg = Debug|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Release|Any CPU.Build.0 = Release|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Release|x86.ActiveCfg = Release|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Debug|x86.ActiveCfg = Debug|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Release|Any CPU.Build.0 = Release|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Release|x86.ActiveCfg = Release|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Debug|x86.ActiveCfg = Debug|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Release|Any CPU.Build.0 = Release|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Release|x86.ActiveCfg = Release|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Debug|Any CPU.Build.0 = Debug|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Debug|x86.ActiveCfg = Debug|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Release|Any CPU.ActiveCfg = Release|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Release|Any CPU.Build.0 = Release|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Release|x86.ActiveCfg = Release|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Debug|x86.ActiveCfg = Debug|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Release|Any CPU.Build.0 = Release|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Release|x86.ActiveCfg = Release|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Debug|x86.ActiveCfg = Debug|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Release|Any CPU.Build.0 = Release|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Release|x86.ActiveCfg = Release|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Debug|x86.ActiveCfg = Debug|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Release|Any CPU.Build.0 = Release|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Release|x86.ActiveCfg = Release|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Debug|x86.ActiveCfg = Debug|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Release|Any CPU.Build.0 = Release|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Release|x86.ActiveCfg = Release|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Debug|x86.ActiveCfg = Debug|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Release|Any CPU.Build.0 = Release|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Release|x86.ActiveCfg = Release|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Debug|x86.ActiveCfg = Debug|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Release|Any CPU.Build.0 = Release|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Release|x86.ActiveCfg = Release|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Debug|x86.ActiveCfg = Debug|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Release|Any CPU.Build.0 = Release|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Release|x86.ActiveCfg = Release|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Debug|x86.ActiveCfg = Debug|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Release|Any CPU.Build.0 = Release|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Release|x86.ActiveCfg = Release|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Debug|x86.ActiveCfg = Debug|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Release|Any CPU.Build.0 = Release|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Release|x86.ActiveCfg = Release|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Debug|x86.ActiveCfg = Debug|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Release|Any CPU.Build.0 = Release|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Release|x86.ActiveCfg = Release|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Debug|x86.ActiveCfg = Debug|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Release|Any CPU.Build.0 = Release|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Release|x86.ActiveCfg = Release|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Debug|x86.ActiveCfg = Debug|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Release|Any CPU.Build.0 = Release|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Release|x86.ActiveCfg = Release|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Debug|x86.ActiveCfg = Debug|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Release|Any CPU.Build.0 = Release|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Release|x86.ActiveCfg = Release|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Debug|x86.ActiveCfg = Debug|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Release|Any CPU.Build.0 = Release|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Release|x86.ActiveCfg = Release|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Debug|x86.ActiveCfg = Debug|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Release|Any CPU.Build.0 = Release|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Release|x86.ActiveCfg = Release|Any CPU
{02B02379-2596-4E45-8B10-835D62EA2D9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{02B02379-2596-4E45-8B10-835D62EA2D9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{02B02379-2596-4E45-8B10-835D62EA2D9E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{02B02379-2596-4E45-8B10-835D62EA2D9E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{02B02379-2596-4E45-8B10-835D62EA2D9E}.Debug|x86.ActiveCfg = Debug|Any CPU
{02B02379-2596-4E45-8B10-835D62EA2D9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{02B02379-2596-4E45-8B10-835D62EA2D9E}.Release|Any CPU.Build.0 = Release|Any CPU
{02B02379-2596-4E45-8B10-835D62EA2D9E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{02B02379-2596-4E45-8B10-835D62EA2D9E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{02B02379-2596-4E45-8B10-835D62EA2D9E}.Release|x86.ActiveCfg = Release|Any CPU
{BB355D2C-FB4F-4526-9B40-7944C40FDFDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB355D2C-FB4F-4526-9B40-7944C40FDFDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB355D2C-FB4F-4526-9B40-7944C40FDFDA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{BB355D2C-FB4F-4526-9B40-7944C40FDFDA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{BB355D2C-FB4F-4526-9B40-7944C40FDFDA}.Debug|x86.ActiveCfg = Debug|Any CPU
{BB355D2C-FB4F-4526-9B40-7944C40FDFDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB355D2C-FB4F-4526-9B40-7944C40FDFDA}.Release|Any CPU.Build.0 = Release|Any CPU
{BB355D2C-FB4F-4526-9B40-7944C40FDFDA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BB355D2C-FB4F-4526-9B40-7944C40FDFDA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{BB355D2C-FB4F-4526-9B40-7944C40FDFDA}.Release|x86.ActiveCfg = Release|Any CPU
{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB}.Debug|x86.ActiveCfg = Debug|Any CPU
{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB}.Release|Any CPU.Build.0 = Release|Any CPU
{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB}.Release|x86.ActiveCfg = Release|Any CPU
{FFEA1F81-9631-43A8-8368-FBC14B1E7B02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFEA1F81-9631-43A8-8368-FBC14B1E7B02}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFEA1F81-9631-43A8-8368-FBC14B1E7B02}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FFEA1F81-9631-43A8-8368-FBC14B1E7B02}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{FFEA1F81-9631-43A8-8368-FBC14B1E7B02}.Debug|x86.ActiveCfg = Debug|Any CPU
{FFEA1F81-9631-43A8-8368-FBC14B1E7B02}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFEA1F81-9631-43A8-8368-FBC14B1E7B02}.Release|Any CPU.Build.0 = Release|Any CPU
{FFEA1F81-9631-43A8-8368-FBC14B1E7B02}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{FFEA1F81-9631-43A8-8368-FBC14B1E7B02}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{FFEA1F81-9631-43A8-8368-FBC14B1E7B02}.Release|x86.ActiveCfg = Release|Any CPU
{71848958-61FC-49B1-986B-CD824F9C3D9C}.Debug|Any CPU.ActiveCfg = Debug|x86
{71848958-61FC-49B1-986B-CD824F9C3D9C}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{71848958-61FC-49B1-986B-CD824F9C3D9C}.Debug|Mixed Platforms.Build.0 = Debug|x86
{71848958-61FC-49B1-986B-CD824F9C3D9C}.Debug|x86.ActiveCfg = Debug|x86
{71848958-61FC-49B1-986B-CD824F9C3D9C}.Debug|x86.Build.0 = Debug|x86
{71848958-61FC-49B1-986B-CD824F9C3D9C}.Release|Any CPU.ActiveCfg = Release|x86
{71848958-61FC-49B1-986B-CD824F9C3D9C}.Release|Mixed Platforms.ActiveCfg = Release|x86
{71848958-61FC-49B1-986B-CD824F9C3D9C}.Release|Mixed Platforms.Build.0 = Release|x86
{71848958-61FC-49B1-986B-CD824F9C3D9C}.Release|x86.ActiveCfg = Release|x86
{71848958-61FC-49B1-986B-CD824F9C3D9C}.Release|x86.Build.0 = Release|x86
{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA}.Debug|Any CPU.ActiveCfg = Debug|x86
{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA}.Debug|Mixed Platforms.Build.0 = Debug|x86
{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA}.Debug|x86.ActiveCfg = Debug|x86
{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA}.Debug|x86.Build.0 = Debug|x86
{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA}.Release|Any CPU.ActiveCfg = Release|x86
{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA}.Release|Mixed Platforms.ActiveCfg = Release|x86
{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA}.Release|Mixed Platforms.Build.0 = Release|x86
{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA}.Release|x86.ActiveCfg = Release|x86
{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA}.Release|x86.Build.0 = Release|x86
{AA4E9904-77D0-406B-A50C-A0508DDB56A7}.Debug|Any CPU.ActiveCfg = Debug|x86
{AA4E9904-77D0-406B-A50C-A0508DDB56A7}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{AA4E9904-77D0-406B-A50C-A0508DDB56A7}.Debug|Mixed Platforms.Build.0 = Debug|x86
{AA4E9904-77D0-406B-A50C-A0508DDB56A7}.Debug|x86.ActiveCfg = Debug|x86
{AA4E9904-77D0-406B-A50C-A0508DDB56A7}.Debug|x86.Build.0 = Debug|x86
{AA4E9904-77D0-406B-A50C-A0508DDB56A7}.Release|Any CPU.ActiveCfg = Release|x86
{AA4E9904-77D0-406B-A50C-A0508DDB56A7}.Release|Mixed Platforms.ActiveCfg = Release|x86
{AA4E9904-77D0-406B-A50C-A0508DDB56A7}.Release|Mixed Platforms.Build.0 = Release|x86
{AA4E9904-77D0-406B-A50C-A0508DDB56A7}.Release|x86.ActiveCfg = Release|x86
{AA4E9904-77D0-406B-A50C-A0508DDB56A7}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C8FA4073-B24E-4178-93A1-5E1256C8B528} = {A466054B-B601-46A2-8D7B-03DE10A94F09}
{442DAB16-3063-4FE3-90B6-C29C3D85360D} = {A466054B-B601-46A2-8D7B-03DE10A94F09}
{C24A3FC4-2541-4E9C-BADD-564777610B75} = {A466054B-B601-46A2-8D7B-03DE10A94F09}
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B} = {A466054B-B601-46A2-8D7B-03DE10A94F09}
{43B24DC5-16D6-45EF-93F1-B021B785A892} = {08B11E56-AB8C-4374-8709-45631094B29B}
{652AFEEB-B19C-4C67-A014-2248EA72F229} = {08B11E56-AB8C-4374-8709-45631094B29B}
{94A4E298-F324-4531-856F-127505F766E5} = {08B11E56-AB8C-4374-8709-45631094B29B}
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7} = {08B11E56-AB8C-4374-8709-45631094B29B}
{1567BCCE-7BE9-4815-84D7-7F794DB39081} = {D0ED3F4D-113E-4858-8042-C657CAC0CF46}
{5C77A144-3CD1-42FC-B622-410E1945CA1E} = {D0ED3F4D-113E-4858-8042-C657CAC0CF46}
{497A578E-EF93-4190-96E0-B7F22E08027B} = {D0ED3F4D-113E-4858-8042-C657CAC0CF46}
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A} = {D0ED3F4D-113E-4858-8042-C657CAC0CF46}
{41326141-EB24-4984-9D9B-5CFAA55946BA} = {B4F52628-112A-4C09-A597-2DC7B5AEE818}
{3C1249FC-B5DF-4E3A-ADDD-817526254876} = {B4F52628-112A-4C09-A597-2DC7B5AEE818}
{E97412B5-8C91-4236-8E9A-24C8E20BC675} = {B4F52628-112A-4C09-A597-2DC7B5AEE818}
{0B899C26-9114-440A-A8A1-615CDE7EE6BD} = {B4F52628-112A-4C09-A597-2DC7B5AEE818}
{6414BA5A-8CB7-4022-AABB-7E38BB6DB5EA} = {B4F52628-112A-4C09-A597-2DC7B5AEE818}
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3} = {AEB97450-F9CF-4CF4-90D0-6CD5EDAB8588}
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC} = {AEB97450-F9CF-4CF4-90D0-6CD5EDAB8588}
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E} = {AEB97450-F9CF-4CF4-90D0-6CD5EDAB8588}
{7107C352-7F42-497E-A26C-25E9AAE8E54C} = {AEB97450-F9CF-4CF4-90D0-6CD5EDAB8588}
{71848958-61FC-49B1-986B-CD824F9C3D9C} = {AEB97450-F9CF-4CF4-90D0-6CD5EDAB8588}
{02B02379-2596-4E45-8B10-835D62EA2D9E} = {035EFB6B-82E9-4510-AC99-B586E6381B25}
{BB355D2C-FB4F-4526-9B40-7944C40FDFDA} = {035EFB6B-82E9-4510-AC99-B586E6381B25}
{6BB1FF9E-DF15-4999-8EEE-F4DA328FBCBB} = {035EFB6B-82E9-4510-AC99-B586E6381B25}
{FFEA1F81-9631-43A8-8368-FBC14B1E7B02} = {035EFB6B-82E9-4510-AC99-B586E6381B25}
{AA4E9904-77D0-406B-A50C-A0508DDB56A7} = {035EFB6B-82E9-4510-AC99-B586E6381B25}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = NUnitLiteTests\NUnitLiteTests.csproj
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,217 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-2.0", "src\framework\nunitlite-2.0.csproj", "{C24A3FC4-2541-4E9C-BADD-564777610B75}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-2.0", "src\tests\nunitlite.tests-2.0.csproj", "{C8FA4073-B24E-4178-93A1-5E1256C8B528}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestResultConsole", "src\TestResultConsole\TestResultConsole.csproj", "{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-2.0", "src\testdata\nunitlite.testdata-2.0.csproj", "{442DAB16-3063-4FE3-90B6-C29C3D85360D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NET-2.0", "NET-2.0", "{A466054B-B601-46A2-8D7B-03DE10A94F09}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NET-3.5", "NET-3.5", "{08B11E56-AB8C-4374-8709-45631094B29B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NET-4.0", "NET-4.0", "{D0ED3F4D-113E-4858-8042-C657CAC0CF46}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-3.5", "src\framework\nunitlite-3.5.csproj", "{43B24DC5-16D6-45EF-93F1-B021B785A892}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-3.5", "src\testdata\nunitlite.testdata-3.5.csproj", "{652AFEEB-B19C-4C67-A014-2248EA72F229}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-3.5", "src\tests\nunitlite.tests-3.5.csproj", "{94A4E298-F324-4531-856F-127505F766E5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-4.0", "src\framework\nunitlite-4.0.csproj", "{1567BCCE-7BE9-4815-84D7-7F794DB39081}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-4.0", "src\testdata\nunitlite.testdata-4.0.csproj", "{5C77A144-3CD1-42FC-B622-410E1945CA1E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-4.0", "src\tests\nunitlite.tests-4.0.csproj", "{497A578E-EF93-4190-96E0-B7F22E08027B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{601BC853-DE7B-47EB-A92B-AEDE16A17FCF}"
ProjectSection(SolutionItems) = preProject
CHANGES.txt = CHANGES.txt
LICENSE.txt = LICENSE.txt
NOTES.txt = NOTES.txt
nunitlite.build = nunitlite.build
nunitlite.build.include = nunitlite.build.include
NUnitLite.nuspec = NUnitLite.nuspec
NUnitLiteCF.nuspec = NUnitLiteCF.nuspec
README.txt = README.txt
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-2.0", "src\mock-assembly\mock-assembly-2.0.csproj", "{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-3.5", "src\mock-assembly\mock-assembly-3.5.csproj", "{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-4.0", "src\mock-assembly\mock-assembly-4.0.csproj", "{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SL-4.0", "SL-4.0", "{B4F52628-112A-4C09-A597-2DC7B5AEE818}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-sl-4.0", "src\framework\nunitlite-sl-4.0.csproj", "{41326141-EB24-4984-9D9B-5CFAA55946BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-sl-4.0", "src\mock-assembly\mock-assembly-sl-4.0.csproj", "{3C1249FC-B5DF-4E3A-ADDD-817526254876}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-sl-4.0", "src\testdata\nunitlite.testdata-sl-4.0.csproj", "{E97412B5-8C91-4236-8E9A-24C8E20BC675}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-sl-4.0", "src\tests\nunitlite.tests-sl-4.0.csproj", "{0B899C26-9114-440A-A8A1-615CDE7EE6BD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SL-5.0", "SL-5.0", "{AEB97450-F9CF-4CF4-90D0-6CD5EDAB8588}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-sl-5.0", "src\framework\nunitlite-sl-5.0.csproj", "{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-sl-5.0", "src\mock-assembly\mock-assembly-sl-5.0.csproj", "{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-sl-5.0", "src\testdata\nunitlite.testdata-sl-5.0.csproj", "{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-sl-5.0", "src\tests\nunitlite.tests-sl-5.0.csproj", "{7107C352-7F42-497E-A26C-25E9AAE8E54C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NET-4.5", "NET-4.5", "{7A9A84BF-A996-43E4-8893-F7D69E8FA293}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-4.5", "src\framework\nunitlite-4.5.csproj", "{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-4.5", "src\mock-assembly\mock-assembly-4.5.csproj", "{A57FFBD8-684A-4868-A4E1-A5D28EC6EA3B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-4.5", "src\testdata\nunitlite.testdata-4.5.csproj", "{6358FBCA-9CA2-4A70-AF87-18B916400CEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-4.5", "src\tests\nunitlite.tests-4.5.csproj", "{B08DC15F-FC46-4B50-9366-8F745F41A869}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C24A3FC4-2541-4E9C-BADD-564777610B75}.Release|Any CPU.Build.0 = Release|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8FA4073-B24E-4178-93A1-5E1256C8B528}.Release|Any CPU.Build.0 = Release|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}.Release|Any CPU.Build.0 = Release|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{442DAB16-3063-4FE3-90B6-C29C3D85360D}.Release|Any CPU.Build.0 = Release|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43B24DC5-16D6-45EF-93F1-B021B785A892}.Release|Any CPU.Build.0 = Release|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Debug|Any CPU.Build.0 = Debug|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Release|Any CPU.ActiveCfg = Release|Any CPU
{652AFEEB-B19C-4C67-A014-2248EA72F229}.Release|Any CPU.Build.0 = Release|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94A4E298-F324-4531-856F-127505F766E5}.Release|Any CPU.Build.0 = Release|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1567BCCE-7BE9-4815-84D7-7F794DB39081}.Release|Any CPU.Build.0 = Release|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C77A144-3CD1-42FC-B622-410E1945CA1E}.Release|Any CPU.Build.0 = Release|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{497A578E-EF93-4190-96E0-B7F22E08027B}.Release|Any CPU.Build.0 = Release|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B}.Release|Any CPU.Build.0 = Release|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7}.Release|Any CPU.Build.0 = Release|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A}.Release|Any CPU.Build.0 = Release|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41326141-EB24-4984-9D9B-5CFAA55946BA}.Release|Any CPU.Build.0 = Release|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C1249FC-B5DF-4E3A-ADDD-817526254876}.Release|Any CPU.Build.0 = Release|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E97412B5-8C91-4236-8E9A-24C8E20BC675}.Release|Any CPU.Build.0 = Release|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B899C26-9114-440A-A8A1-615CDE7EE6BD}.Release|Any CPU.Build.0 = Release|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3}.Release|Any CPU.Build.0 = Release|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC}.Release|Any CPU.Build.0 = Release|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E}.Release|Any CPU.Build.0 = Release|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7107C352-7F42-497E-A26C-25E9AAE8E54C}.Release|Any CPU.Build.0 = Release|Any CPU
{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Release|Any CPU.Build.0 = Release|Any CPU
{A57FFBD8-684A-4868-A4E1-A5D28EC6EA3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A57FFBD8-684A-4868-A4E1-A5D28EC6EA3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A57FFBD8-684A-4868-A4E1-A5D28EC6EA3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A57FFBD8-684A-4868-A4E1-A5D28EC6EA3B}.Release|Any CPU.Build.0 = Release|Any CPU
{6358FBCA-9CA2-4A70-AF87-18B916400CEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6358FBCA-9CA2-4A70-AF87-18B916400CEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6358FBCA-9CA2-4A70-AF87-18B916400CEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6358FBCA-9CA2-4A70-AF87-18B916400CEE}.Release|Any CPU.Build.0 = Release|Any CPU
{B08DC15F-FC46-4B50-9366-8F745F41A869}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B08DC15F-FC46-4B50-9366-8F745F41A869}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B08DC15F-FC46-4B50-9366-8F745F41A869}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B08DC15F-FC46-4B50-9366-8F745F41A869}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C8FA4073-B24E-4178-93A1-5E1256C8B528} = {A466054B-B601-46A2-8D7B-03DE10A94F09}
{442DAB16-3063-4FE3-90B6-C29C3D85360D} = {A466054B-B601-46A2-8D7B-03DE10A94F09}
{C24A3FC4-2541-4E9C-BADD-564777610B75} = {A466054B-B601-46A2-8D7B-03DE10A94F09}
{1516338A-F26B-4BA7-AF6E-C3F6A39DC45B} = {A466054B-B601-46A2-8D7B-03DE10A94F09}
{43B24DC5-16D6-45EF-93F1-B021B785A892} = {08B11E56-AB8C-4374-8709-45631094B29B}
{652AFEEB-B19C-4C67-A014-2248EA72F229} = {08B11E56-AB8C-4374-8709-45631094B29B}
{94A4E298-F324-4531-856F-127505F766E5} = {08B11E56-AB8C-4374-8709-45631094B29B}
{1798FBBC-4B6E-4ED8-90A8-7DD9C36194E7} = {08B11E56-AB8C-4374-8709-45631094B29B}
{1567BCCE-7BE9-4815-84D7-7F794DB39081} = {D0ED3F4D-113E-4858-8042-C657CAC0CF46}
{5C77A144-3CD1-42FC-B622-410E1945CA1E} = {D0ED3F4D-113E-4858-8042-C657CAC0CF46}
{497A578E-EF93-4190-96E0-B7F22E08027B} = {D0ED3F4D-113E-4858-8042-C657CAC0CF46}
{961F4A5A-CAC4-4A53-9EF0-C6EE26A6429A} = {D0ED3F4D-113E-4858-8042-C657CAC0CF46}
{41326141-EB24-4984-9D9B-5CFAA55946BA} = {B4F52628-112A-4C09-A597-2DC7B5AEE818}
{3C1249FC-B5DF-4E3A-ADDD-817526254876} = {B4F52628-112A-4C09-A597-2DC7B5AEE818}
{E97412B5-8C91-4236-8E9A-24C8E20BC675} = {B4F52628-112A-4C09-A597-2DC7B5AEE818}
{0B899C26-9114-440A-A8A1-615CDE7EE6BD} = {B4F52628-112A-4C09-A597-2DC7B5AEE818}
{5EFE54B3-2494-4DF4-A42A-8492A5EC4BA3} = {AEB97450-F9CF-4CF4-90D0-6CD5EDAB8588}
{3C19A734-11BB-48FD-81D0-042B6A8D4CFC} = {AEB97450-F9CF-4CF4-90D0-6CD5EDAB8588}
{A2B5D1FA-D865-4B30-A82D-30BB1C8C474E} = {AEB97450-F9CF-4CF4-90D0-6CD5EDAB8588}
{7107C352-7F42-497E-A26C-25E9AAE8E54C} = {AEB97450-F9CF-4CF4-90D0-6CD5EDAB8588}
{D12F0F7B-8DE3-43EC-BA49-41052D065A9B} = {7A9A84BF-A996-43E4-8893-F7D69E8FA293}
{A57FFBD8-684A-4868-A4E1-A5D28EC6EA3B} = {7A9A84BF-A996-43E4-8893-F7D69E8FA293}
{6358FBCA-9CA2-4A70-AF87-18B916400CEE} = {7A9A84BF-A996-43E4-8893-F7D69E8FA293}
{B08DC15F-FC46-4B50-9366-8F745F41A869} = {7A9A84BF-A996-43E4-8893-F7D69E8FA293}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = NUnitLiteTests\NUnitLiteTests.csproj
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>NUnitLiteCF</id>
<version>${package.version}${package.suffix}</version>
<authors>Charlie Poole</authors>
<owners>Charlie Poole</owners>
<licenseUrl>http://nunit.org/nuget/nunitlite-license.txt</licenseUrl>
<projectUrl>http://nunitlite.org</projectUrl>
<iconUrl>http://nunit.org/nuget/nunit_32x32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>NUnitLite is a lightweight testing framework for .NET, based on NUnit.</summary>
<description>NUnitLite provides a subset of the features of NUnit, uses minimal resources and runs on resource-restricted platforms used in embedded and mobile development. This package contains builds of NUnitLite for the .NET Compact Framework.&#10;&#13;How to use this package:&#10;&#13;1. Create a console application for your tests and delete the generated class containing Main().&#10;&#13;2. Install the NUnitLite package, which creates a new Main() as well as adding a reference to NUnitLite.&#10;&#13;3. Add your tests to the test project and start the project to execute them.</description>
<copyright>Copyright (c) 2004-2012 Charlie Poole</copyright>
<language>en-US</language>
<tags>test testing tdd framework fluent assert device phone compact embedded</tags>
</metadata>
<files>
<file src="LICENSE.txt" />
<file src="README.txt" />
<file src="CHANGES.txt" />
<file src="package\${package.base.name}\netcf-3.5\nunitlite.dll" target="lib/net35-cf" />
<file src="package\${package.base.name}\netcf-3.5\nunitlite.xml" target="lib/net35-cf" />
<file src="package\${package.base.name}\netcf-2.0\nunitlite.dll" target="lib/net20-cf" />
<file src="package\${package.base.name}\netcf-2.0\nunitlite.xml" target="lib/net20-cf" />
<file src="src\tests\Program.cs" target="content" />
</files>
</package>

Просмотреть файл

@ -0,0 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-netcf-2.0", "src\framework\nunitlite-netcf-2.0.csproj", "{BED999D7-F594-4CE4-A037-E40E2B9C1288}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-netcf-2.0", "src\testdata\nunitlite.testdata-netcf-2.0.csproj", "{F67E80E8-DF9F-4C66-9142-5002FA638EB7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-netcf-2.0", "src\tests\nunitlite.tests-netcf-2.0.csproj", "{4B518BF0-D523-4F75-AF3B-9B41865E634A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-netcf-2.0", "src\mock-assembly\mock-assembly-netcf-2.0.csproj", "{33EA4538-3452-42ED-92A9-4CC3B25032AD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BED999D7-F594-4CE4-A037-E40E2B9C1288}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BED999D7-F594-4CE4-A037-E40E2B9C1288}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BED999D7-F594-4CE4-A037-E40E2B9C1288}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BED999D7-F594-4CE4-A037-E40E2B9C1288}.Release|Any CPU.Build.0 = Release|Any CPU
{F67E80E8-DF9F-4C66-9142-5002FA638EB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F67E80E8-DF9F-4C66-9142-5002FA638EB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F67E80E8-DF9F-4C66-9142-5002FA638EB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F67E80E8-DF9F-4C66-9142-5002FA638EB7}.Release|Any CPU.Build.0 = Release|Any CPU
{4B518BF0-D523-4F75-AF3B-9B41865E634A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B518BF0-D523-4F75-AF3B-9B41865E634A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B518BF0-D523-4F75-AF3B-9B41865E634A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{4B518BF0-D523-4F75-AF3B-9B41865E634A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B518BF0-D523-4F75-AF3B-9B41865E634A}.Release|Any CPU.Build.0 = Release|Any CPU
{4B518BF0-D523-4F75-AF3B-9B41865E634A}.Release|Any CPU.Deploy.0 = Release|Any CPU
{33EA4538-3452-42ED-92A9-4CC3B25032AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33EA4538-3452-42ED-92A9-4CC3B25032AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33EA4538-3452-42ED-92A9-4CC3B25032AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33EA4538-3452-42ED-92A9-4CC3B25032AD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite-netcf-3.5", "src\framework\nunitlite-netcf-3.5.csproj", "{5F6CB3DC-5CE5-4C6A-AB23-936DB3B35DCC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.testdata-netcf-3.5", "src\testdata\nunitlite.testdata-netcf-3.5.csproj", "{0B7C0B55-6A49-4F32-993E-C9ED6DA0B73C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunitlite.tests-netcf-3.5", "src\tests\nunitlite.tests-netcf-3.5.csproj", "{80A9EC94-2C42-44AC-9D2C-E1418D712C48}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly-netcf-3.5", "src\mock-assembly\mock-assembly-netcf-3.5.csproj", "{B0C85907-1103-44F4-ACFF-6A1B9170C0B1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5F6CB3DC-5CE5-4C6A-AB23-936DB3B35DCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5F6CB3DC-5CE5-4C6A-AB23-936DB3B35DCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5F6CB3DC-5CE5-4C6A-AB23-936DB3B35DCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F6CB3DC-5CE5-4C6A-AB23-936DB3B35DCC}.Release|Any CPU.Build.0 = Release|Any CPU
{0B7C0B55-6A49-4F32-993E-C9ED6DA0B73C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B7C0B55-6A49-4F32-993E-C9ED6DA0B73C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B7C0B55-6A49-4F32-993E-C9ED6DA0B73C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B7C0B55-6A49-4F32-993E-C9ED6DA0B73C}.Release|Any CPU.Build.0 = Release|Any CPU
{80A9EC94-2C42-44AC-9D2C-E1418D712C48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80A9EC94-2C42-44AC-9D2C-E1418D712C48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80A9EC94-2C42-44AC-9D2C-E1418D712C48}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{80A9EC94-2C42-44AC-9D2C-E1418D712C48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80A9EC94-2C42-44AC-9D2C-E1418D712C48}.Release|Any CPU.Build.0 = Release|Any CPU
{80A9EC94-2C42-44AC-9D2C-E1418D712C48}.Release|Any CPU.Deploy.0 = Release|Any CPU
{B0C85907-1103-44F4-ACFF-6A1B9170C0B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0C85907-1103-44F4-ACFF-6A1B9170C0B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0C85907-1103-44F4-ACFF-6A1B9170C0B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0C85907-1103-44F4-ACFF-6A1B9170C0B1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

154
NUnitLite-1.0.0/README.txt Normal file
Просмотреть файл

@ -0,0 +1,154 @@
NUnitLite Version 1.0 - September 13, 2013
NUnitLite is a small-footprint implementation of much of the current NUnit framework. It is distributed in source form and is intended for use in situations where NUnit is too large or complex. In particular, it targets mobile and embedded environments as well as testing of applications that require "embedding" the framework in another piece of software, as when testing plugin architectures.
This file provides basic information about NUnitLite. For more info see the NUnitLite web site at http://nunitlite.com.
COPYRIGHT AND LICENSE
NUnitLite is Copyright 2004-2013, Charlie Poole and is licensed under the MIT license.
A copy of the license is distributed with the program in the file LICENSE.txt and is also available at http://www.opensource.org/licenses/mit-license.php.
NUnitLite is based on ideas in NUnit, but not on the NUnit implementation. In addition, some code developed in NUnitLite was subsequently contributed to the NUnit project, where it is available under the NUnit license. Subsequently, some (but not all) of the newer NUnit features were ported back to NUnitLite.
ATTRIBUTES
NUnitLite supports most of the same attributes as NUnit 2.6.2.
CategoryAttribute
CombinatorialAttribute
CultureAttribute
DatapointAttribute
DatapointsAttribute
DescriptionAttribute
ExpectedExceptionAttribute
ExplicitAttribute
IgnoreAttribute
MaxTimeAttribute
PairwiseAttribute
PlatformAttribute
PropertyAttribute
RandomAttribute
RangeAttribute
SequentialAttribute
SetCultureAttribute (not available on compact framework)
SetUICultureAttribute (not available on compact framework)
SetUpAttribute
TearDownAttribute
TestAttribute
TestCaseAttribute
TestCaseSourceAttribute
TestFixtureAttribute
TestFixtureSetUpAttribute
TestFixtureTearDownAttribute
TheoryAttribute
TimeoutAttribute
ValuesAttribute
ValueSourceAttribute
ASSERTS
The programmer expresses expected test conditions using the Assert class. The existing functionality of most current NUnit Assert methods is supported, but the syntax has been changed to use the more extensible constraint-based format. The following methods are supported:
Assert.Pass
Assert.Fail
Assert.Ignore
Assert.Inconclusive
Assert.That
Assert.ByVal
Assert.Throws
Assert.DoesNotThrow
Assert.Catch
Assert.Null
Assert.NotNull
Assert.True
Assert.False
Assert.AreEqual
Assert.AreNotEqual
Assert.AreSame
Assert.AreNotSame
ASSUMPTIONS
The programmer may express assumptions in the test using Assume.That() A failure in Assume.That causes an Inconclusive result.
CONSTRAINTS
NUnitLite supports most of the same built-in constraints as NUnit. Users may also derive custom constraints from the abstract Constraint class. The following built-in constraints are provided:
AllItemsConstraint
AndConstraint
AssignableFromConstraint
AssignableToConstraint
AttributeConstraint
AttributeExistsConstraint
BinarySerializableConstraint (not available on compact framework)
CollectionContainsConstraint
CollectionEquivalentConstraint
CollectionOrderedConstraint
CollectionSubsetConstraint
ContainsConstraint
DelayedConstraint
EmptyCollectionConstraint
EmptyConstraint
EmptyDirectoryConstraint
EmptyStringConstraint
EndsWithConstraint
EqualConstraint
ExactCountConstraint
ExactTypeConstraint
ExceptionTypeConstraint
FalseConstraint
GreaterThanConstraint
GreaterThanOrEqualConstraint
InstanceOfTypeConstraint
LessThanConstraint
LessThanOrEqualConstraint
NaNConstraint
NoItemConstraint
NotConstraint
NullConstraint
NullOrEmptyStringConstraint
OrConstraint
PredicateConstraint
PropertyConstraint
PropertyExistsConstraint
RangeConstraint
RegexConstraint (not available on compact framework)
ReusableConstraint
SameAsConstraint
SamePathConstraint
SamePathOrUnderConstraint
SomeItemsConstraint
StartsWithConstraint
SubPathConstraint
SubstringConstraint
ThrowsConstraint
ThrowsNothingConstraint
TrueConstraint
UniqueItemsConstraint
XmlSerializableConstraint (not available on compact framework 1.0)
Although constraints may be created using their constructors, the more usual approach is to make use of one or more of the NUnitLite SyntaxHelpers. The following helpers are provided:
Is: Not, All, Null, True, False, Positive, Negative, NaN, Empty, Unique,
EqualTo, SameAs, GreaterThan, GreaterThanOrEqualTo, LessThan, LessThanOrEqualTo,
AtLeast, AtMost, TypeOf, InstanceOf, AssignableFrom, AssignableTo,
StringContaining, StringStarting, StringEnding, StringMatching,
EquivalentTo, SubsetOf, BinarySerializable, XmlSerializable,
Ordered, SamePath, SamePathOrUnder, InRange
Contains: Substring, Item
Has: No, All, Some, None,Exactly, Property, Length, Count, Message, InnerException, Member, Attribute
Tests are loaded as a tree structure of suites, fixtures and test cases. Each fixture contains it's tests. Tests are executed in the order found, without any guarantees of ordering. A separate instance of the fixture object is created for each test case executed by NUnitLite. The embedded console runner produces a summary of tests run and lists any errors or failures. It can also save an XML representation of the test results.
USAGE
NUnitLite is not "installed" in your system. Instead, you should include nunitlite.dll in your project. Your test assembly should be an exe file and should reference the nunitlite assembly. If you place a call like this in your Main
new TextUI().Execute(args);
then NUnitLite will run all the tests in the test project, using the args provided. Use -help to see the available options.
DOCUMENTATION
NUnitLite uses the NUnit.Framework namespace, which allows relatively easy portability between NUnit and NUnitLite. Currently, there is no separate set of documentation for NUnitLite so you should use the docs for NUnit 2.6 or later in conjunction with the information in this file.

2
NUnitLite-1.0.0/nant.bat Normal file
Просмотреть файл

@ -0,0 +1,2 @@
tools\nant\bin\nant.exe %*

Просмотреть файл

@ -0,0 +1,402 @@
<?xml version="1.0"?>
<project name="NUnit" default="help" basedir=".">
<!-- ***************************************************************** -->
<!-- This script has been tested using NAnt 0.92. At least -->
<!-- one of the supported runtimes and sdk must be installed. In -->
<!-- order to build the msi, WiX 2.0 and the WiX tasks for NAnt -->
<!-- are required. To run the test coverage target, NCover is -->
<!-- required. -->
<!-- ***************************************************************** -->
<!-- TODO: Edit above to reflect actual targets -->
<!-- ***************************************************************** -->
<!-- *** Default Help Target *** -->
<!-- ***************************************************************** -->
<target name="help">
<echo>
This build file will build NUnitLite for any of the supported
runtime frameworks which are actually installed. To add support
for a framework, edit this script
Running on the current system, the following runtime frameworks
are available for building and testing NUnit:
</echo>
<foreach item="String" delim=","
property="framework" in="${installed.frameworks}">
<echo message=" ${string::pad-right(framework,18,' ')}${framework::get-description(framework)}"/>
</foreach>
<echo>
Note that targets that set the build configuration or runtime
to be used must come before action targets. For example:
nant net-2.0 release build
nant build-all
nant debug clean build
Use nant -projecthelp to see a full list of targets.
</echo>
</target>
<!-- ***************************************************************** -->
<!-- ********* Common properties that control the build ************** -->
<!-- ***************************************************************** -->
<!-- Project name - used as a prefix for packages -->
<property name="project.name" value="NUnitLite"/>
<!-- NUnit version for packaging -->
<property name="package.version" value="1.0.0"/>
<!-- Additional suffix used to distinguish files with the same version -->
<property name="package.suffix" value=""/>
<!-- Frameworks supported by this build script -->
<property name="supported.frameworks"
value="net-1.1,net-2.0,net-3.5,net-4.0,net-4.5,netcf-2.0,netcf-3.5,mono-2.0,mono-3.5,mono-4.0,silverlight-3.0,silverlight-4.0,silverlight-5.0"/>
<!-- Framework versions for which packages are normally created -->
<property name="standard.packages"
value="net-1.1,net-2.0,net-3.5,net-4.0,net-4.5,netcf-2.0,netcf-3.5,silverlight-3.0,silverlight-4.0,silverlight-5.0" />
<!-- Nuget packages normally created -->
<property name="nuget.packages" value="NUnitLite,NUnitLiteCF"/>
<!-- Additional internal properties are set in the include file -->
<include buildfile="nunitlite.build.include"/>
<!-- ***************************************************************** -->
<!-- *** Targets that set the build configuration *** -->
<!-- *** These must come before actions like build or test *** -->
<!-- ***************************************************************** -->
<target name="debug" description="Set config to debug for commands that follow">
<call target="set-debug-build-config" />
</target>
<target name="release" description="Set config to release for commands that follow">
<call target="set-release-build-config" />
</target>
<!-- ***************************************************************** -->
<!-- *** Targets that set the runtime configuration *** -->
<!-- *** These must come before actions like build or test *** -->
<!-- ***************************************************************** -->
<target name="net-1.1"
description="Set runtime to .NET 1.1 for targets that follow"
depends="set-net-1.1-runtime-config"/>
<target name="net-2.0"
description="Set runtime to .NET 2.0 for targets that follow"
depends="set-net-2.0-runtime-config"/>
<target name="net-3.5"
description="Set runtime to .NET 3.5 for targets that follow"
depends="set-net-3.5-runtime-config"/>
<target name="net-4.0"
description="Set runtime to .NET 4.0 for targets that follow"
depends="set-net-4.0-runtime-config"/>
<target name="net-4.5"
description="Set runtime to .NET 4.5 for targets that follow"
depends="set-net-4.5-runtime-config"/>
<target name="netcf-2.0"
description="Set runtime to .NET CF 2.0 for targets that follow"
depends="set-netcf-2.0-runtime-config"/>
<target name="netcf-3.5"
description="Set runtime to .NET CF 3.5 for targets that follow"
depends="set-netcf-3.5-runtime-config"/>
<target name="mono-2.0"
description="Set runtime to Mono 2.0 for targets that follow"
depends="set-mono-2.0-runtime-config"/>
<target name="mono-3.5"
description="Set runtime to Mono 3.5 for targets that follow"
depends="set-mono-3.5-runtime-config"/>
<target name="mono-4.0"
description="Set runtime to Mono 4.0 for targets that follow"
depends="set-mono-4.0-runtime-config"/>
<target name="sl-3.0"
description="Set runtime to Silverlight 3.0 for targets that follow"
depends="set-silverlight-3.0-runtime-config"/>
<target name="sl-4.0"
description="Set runtime to Silverlight 4.0 for targets that follow"
depends="set-silverlight-4.0-runtime-config"/>
<target name="sl-5.0"
description="Set runtime to Silverlight 5.0 for targets that follow"
depends="set-silverlight-5.0-runtime-config"/>
<!-- ***************************************************************** -->
<!-- *** Targets that clean directories *** -->
<!-- ***************************************************************** -->
<target name="clean" depends="set-build-dir"
description="Removes the current build directory">
<property name="current.target" value="clean"/>
<call target="run-subprojects"/>
</target>
<target name="clean-all" description="Removes all build directories">
<delete dir="${project.build.dir}"
if="${directory::exists( project.build.dir )}"/>
</target>
<target name="clean-package-dir"
description="Removes the current package working directory">
<delete dir="${package.working.dir}"
if="${directory::exists( package.working.dir )}"/>
</target>
<target name="clean-source-dirs">
<delete>
<fileset>
<include name="*/*/obj/**/*"/>
<include name="*/*/bin/**/*"/>
</fileset>
</delete>
</target>
.
<!-- ***************************************************************** -->
<!-- *** Targets that perform builds *** -->
<!-- ***************************************************************** -->
<target name="build" depends="make-build-dir"
description="Build NUnit for default runtime version and config">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${build.config} build"/>
<echo message="* Current Build Directory = ${current.build.dir}"/>
<echo message="*"/>
<property name="nant.settings.currentframework" value="${build.framework}"/>
<property name="current.target" value="build"/>
<call target="run-subprojects"/>
</target>
<target name="build-all"
description="Build current config for all available runtimes">
<foreach item="String" delim=","
property="framework" in="${installed.frameworks}">
<call target="set-${framework}-runtime-config"/>
<call target="build"/>
</foreach>
</target>
<target name="rebuild" depends="make-build-dir"
description="Rebuild NUnit for default runtime version and config">
<echo message="*"/>
<echo message="* Starting ${runtime.config} ${build.config} rebuild"/>
<echo message="* Current Build Directory = ${current.build.dir}"/>
<echo message="*"/>
<property name="nant.settings.currentframework" value="${build.framework}"/>
<property name="current.target" value="rebuild"/>
<call target="run-subprojects"/>
</target>
<target name="rebuild-all" depends="clean-all,build-all"
description="Rebuild current config for all available runtimes">
<foreach item="String" delim=","
property="framework" in="${installed.frameworks}">
<call target="set-${framework}-runtime-config"/>
<call target="rebuild"/>
</foreach>
</target>
<!-- ***************************************************************** -->
<!-- *** Targets for running tests *** -->
<!-- ***************************************************************** -->
<target name="test" depends="build"
description="Build and run tests for selected config and runtime">
<call target="run-test" unless="${runtime.platform == 'silverlight'}"/>
<call target="run-silverlight-test" if="${runtime.platform == 'silverlight'}"/>
</target>
<target name="ci-test" depends="build"
description="Build and run CI test (no gui) for selected config and runtime">
<call target="run-test" unless="${runtime.platform == 'silverlight'}"/>
<call target="run-silverlight-ci-test" if="${runtime.platform == 'silverlight'}"/>
</target>
<target name="run-test"
description="Run tests for selected config and runtime (no rebuild)">
<property name="nant.settings.currentframework" value="${runtime.config}"/>
<echo message="*"/>
<echo message="* Testing ${runtime.config} ${build.config} build"/>
<echo message="*"/>
<exec basedir="${current.build.dir}"
workingdir="${current.build.dir}"
program="nunitlite.tests.exe"
managed="Strict"/>
</target>
<target name="run-silverlight-test">
<property name="xap.file.name" value="nunitlite.tests-${msbuild.proj.suffix}.xap"/>
<exec program="sllauncher.exe"
basedir="C:\Program Files\Microsoft Silverlight"
workingdir="${current.build.dir}">
<arg value="/emulate:${xap.file.name}"/>
<arg value="/origin:file://TestPage.html"/>
</exec>
</target>
<target name="run-silverlight-ci-test">
<echo message="*"/>
<echo message="* Testing ${runtime.config} ${build.config} build"/>
<echo message="*"/>
<exec basedir="${current.build.dir}"
workingdir="${current.build.dir}"
program="ci-test-runner.exe"
commandline="nunitlite.tests"
managed="Strict"/>
</target>
<target name="test-all"
description="Build and test all runtimes for current config">
<foreach item="String" delim=","
property="framework" in="${installed.frameworks}">
<call target="set-${framework}-runtime-config"/>
<call target="test" />
</foreach>
</target>
<!-- ***************************************************************** -->
<!-- *** Targets for packaging the NUnitLite distribution *** -->
<!-- ***************************************************************** -->
<target name="package" description="Create package for a release">
<call target="package-bins"/>
<call target="package-src"/>
</target>
<target name="package-bins" depends="clean-package-dir"
description="Package binaries for all supported frameworks">
<foreach item="String" delim=","
property="framework" in="${standard.packages}">
<if test="${framework::exists(framework)}">
<if test="${string::starts-with(framework, 'silverlight') or framework::sdk-exists(framework)}">
<call target="set-${framework}-runtime-config"/>
<call target="package-build"/>
</if>
</if>
</foreach>
<!-- Create the zip file -->
<property name="zip.file.name" value="${package.name}" unless="${build.debug}"/>
<property name="zip.file.name" value="${package.name}-dbg" if="${build.debug}"/>
<zip zipfile="${project.package.dir}/${zip.file.name}.zip" ziplevel="9">
<fileset basedir="${package.working.dir}" prefix="${package.base.name}">
<include name="**"/>
</fileset>
</zip>
<!-- Create the NuGet packages -->
<foreach item="String" delim="," property="nuget.package.name" in="${nuget.packages}">
<copy file="${nuget.package.name}.nuspec"
tofile="_TEMP.nuspec"
overwrite="true">
<filterchain>
<expandproperties/>
</filterchain>
</copy>
<exec program="NuGet.exe"
commandline="pack _TEMP.nuspec -OutputDirectory package"
workingdir="."/>
<move file="package/${nuget.package.name}.${package.version}.nupkg"
tofile="package/${nuget.package.name}.${package.version}-dbg.nupkg"
if="${build.debug}"/>
</foreach>
</target>
<target name="package-build" depends="build"
description="Helper that packages the binaries for a single build">
<copy todir="${package.working.dir}/${runtime.config}">
<fileset basedir="${current.build.dir}">
<include name="nunitlite.dll"/>
<include name="nunitlite.pdb"/>
<include name="nunitlite.xml"/>
</fileset>
</copy>
</target>
<target name="package-src" depends="clean-package-dir"
description="Create full source package for developer use">
<copy todir="${package.working.dir}">
<fileset basedir="${project.base.dir}">
<include name="README.txt"/>
<include name="CHANGES.txt"/>
<include name="LICENSE.txt"/>
<include name="nant.bat"/>
<include name="nunitlite.build"/>
<include name="nunitlite.build.include"/>
<include name="NUnitLite.nuspec"/>
<include name="NUnitLite.sln"/>
<include name="NUnitLiteCF.sln"/>
</fileset>
</copy>
<call target="copy-src"/>
<call target="copy-tools"/>
<!-- Create the zip file -->
<zip zipfile="${project.package.dir}/${package.name}-src.zip" ziplevel="9">
<fileset basedir="${package.working.dir}" prefix="${package.base.name}">
<include name="**"/>
</fileset>
</zip>
</target>
</project>

Просмотреть файл

@ -0,0 +1,424 @@
<?xml version="1.0"?>
<project name="NUnit" default="build" basedir=".">
<!-- ***************************************************************** -->
<!-- **********Set Properties used by Various targets **************** -->
<!-- ***************************************************************** -->
<!-- Project base dir is nant project base dir -->
<property name="project.base.dir"
value="${project::get-base-directory()}"/>
<!-- Other directories are derived from base -->
<property name="project.src.dir"
value="${path::combine(project.base.dir,'src')}"/>
<property name="project.tools.dir"
value="${path::combine(project.base.dir,'tools')}"/>
<property name="project.build.dir"
value="${path::combine(project.base.dir,'build')}"/>
<property name="project.package.dir"
value="${path::combine(project.base.dir,'package')}"/>
<!-- Root of the package file name -->
<property name="package.base.name"
value="${project.name}-${package.version}"/>
<property name="package.name"
value="${package.base.name}${package.suffix}"/>
<!-- Package directories -->
<property name="package.working.dir"
value="${path::combine(project.package.dir,package.base.name)}"/>
<property name="package.src.dir"
value="${path::combine(package.working.dir,'src')}"/>
<property name="package.tools.dir"
value="${path::combine(package.working.dir,'tools')}"/>
<!-- Default build configuration -->
<property name="build.config" value="debug"/>
<property name="build.defines" value=""/>
<!-- Default runtime configuration -->
<property name="runtime.config" value="${framework::get-target-framework()}"/>
<!-- Collect list of installed frameworks -->
<foreach item="String" delim=","
property="framework" in="${supported.frameworks}">
<if test="${framework::exists( framework )}">
<if test="${string::starts-with(framework, 'silverlight') or framework::sdk-exists( framework )}">
<property name="installed.frameworks" value="${installed.frameworks},${framework}"
if="${property::exists('installed.frameworks')}"/>
<property name="installed.frameworks" value="${framework}"
unless="${property::exists('installed.frameworks')}"/>
</if>
</if>
</foreach>
<!-- ***************************************************************** -->
<!-- ********* FileSets Used by Various Targets *********** -->
<!-- ***************************************************************** -->
<!-- Files to be copied to source directories -->
<fileset id="source-files" >
<include name="**/*.sln" />
<include name="**/*.csproj" />
<include name="**/*.config" />
<include name="**/*.build" />
<include name="**/*.cs" />
<include name="**/*.xsd" />
<include name="**/*.xslt" />
<include name="**/*.resx" />
<include name="**/*.jpg" />
<include name="**/*.gif" />
<include name="**/*.ico" />
<include name="**/*.txt" />
<include name="**/resources/*" />
<exclude name="**/CVS/**" />
<exclude name="**/bin/**" />
<exclude name="**/obj/**" />
<exclude name="**/Debug/**" />
<exclude name="**/Release/**" />
</fileset>
<!-- ***************************************************************** -->
<!-- ********* Targets for setting the build configuration *********** -->
<!-- ***************************************************************** -->
<target name="set-build-config">
<call target="set-${build.config}-build-config"/>
</target>
<target name="set-debug-build-config">
<property name="build.config" value="debug"/>
<property name="build.debug" value="true"/>
<property name="build.defines" value="DEBUG,TRACE,NUNITLITE,${runtime.defines}"
dynamic="true"/>
</target>
<target name="set-release-build-config">
<property name="build.config" value="release"/>
<property name="build.debug" value="false"/>
<property name="build.defines" value="TRACE,NUNITLITE,${runtime.defines}"
dynamic="true"/>
</target>
<!-- ***************************************************************** -->
<!-- *** Targets for setting the runtime configuration *** -->
<!-- ***************************************************************** -->
<target name="set-runtime-config">
<call target="set-${runtime.config}-runtime-config"/>
</target>
<target name="set-net-1.1-runtime-config">
<fail unless="${framework::exists( 'net-1.1' )}"
message=".NET 1.1 is not installed"/>
<fail unless="${framework::sdk-exists( 'net-1.1' )}"
message="The .NET 1.1 SDK is not configured or not installed"/>
<property name="runtime.platform" value="net"/>
<property name="runtime.version" value="1.1"/>
<property name="runtime.config" value="net-1.1"/>
<property name="runtime.defines" value="NET,NET_1_1,CLR_1_1"/>
<property name="build.framework" value="net-1.1"/>
<property name="build.method" value="nant"/>
<property name="msbuild.proj.suffix" value=""/>
</target>
<target name="set-net-2.0-runtime-config">
<fail unless="${framework::exists( 'net-2.0' )}"
message=".NET 2.0 is not installed"/>
<fail unless="${framework::sdk-exists( 'net-2.0' )}"
message="The .NET 2.0 SDK is not configured or not installed"/>
<property name="runtime.platform" value="net"/>
<property name="runtime.version" value="2.0"/>
<property name="runtime.config" value="net-2.0"/>
<property name="runtime.defines" value="NET,NET_2_0,CLR_2_0"/>
<property name="build.framework" value="net-3.5"/>
<property name="build.method" value="msbuild"/>
<property name="msbuild.proj.suffix" value="2.0"/>
</target>
<target name="set-net-3.5-runtime-config">
<fail unless="${framework::exists( 'net-3.5' )}"
message=".NET 3.5 is not installed"/>
<fail unless="${framework::sdk-exists( 'net-3.5' )}"
message="The .NET 3.5 SDK is not configured or not installed"/>
<property name="runtime.platform" value="net"/>
<property name="runtime.version" value="3.5"/>
<property name="runtime.config" value="net-3.5"/>
<property name="runtime.defines" value="NET,NET_3_5,CLR_2_0"/>
<property name="build.framework" value="net-4.0"/>
<property name="build.method" value="msbuild"/>
<property name="msbuild.proj.suffix" value="3.5"/>
</target>
<target name="set-net-4.0-runtime-config">
<fail unless="${framework::exists( 'net-4.0' )}"
message=".NET 4.0 is not installed"/>
<fail unless="${framework::sdk-exists( 'net-4.0' )}"
message="The .NET 4.0 SDK is not configured or not installed"/>
<property name="runtime.platform" value="net"/>
<property name="runtime.version" value="4.0"/>
<property name="runtime.config" value="net-4.0"/>
<property name="runtime.defines" value="NET,NET_4_0,CLR_4_0"/>
<property name="build.framework" value="net-4.0"/>
<property name="build.method" value="msbuild"/>
<property name="msbuild.proj.suffix" value="4.0"/>
</target>
<target name="set-net-4.5-runtime-config">
<fail unless="${framework::exists( 'net-4.5' )}"
message=".NET 4.5 is not installed"/>
<fail unless="${framework::sdk-exists( 'net-4.5' )}"
message="The .NET 4.5 SDK is not configured or not installed"/>
<property name="runtime.platform" value="net"/>
<property name="runtime.version" value="4.5"/>
<property name="runtime.config" value="net-4.5"/>
<property name="runtime.defines" value="NET,NET_4_5,CLR_4_0"/>
<property name="build.framework" value="net-4.5"/>
<property name="build.method" value="msbuild"/>
<property name="msbuild.proj.suffix" value="4.5"/>
</target>
<target name="set-netcf-2.0-runtime-config">
<fail unless="${framework::exists( 'netcf-2.0' )}"
message=".NET CF 2.0 is not installed"/>
<fail unless="${framework::sdk-exists( 'netcf-2.0' )}"
message="The .NET CF 2.0 SDK is not configured or not installed"/>
<property name="runtime.platform" value="netcf"/>
<property name="runtime.version" value="2.0"/>
<property name="runtime.config" value="netcf-2.0"/>
<property name="runtime.defines" value="NETCF,NETCF_2_0,CLR_2_0"/>
<property name="build.framework" value="netcf-2.0"/>
<property name="build.method" value="msbuild"/>
<property name="msbuild.proj.suffix" value="netcf-2.0"/>
</target>
<target name="set-netcf-3.5-runtime-config">
<!--<fail unless="${framework::exists( 'netcf-3.5' )}"
message=".NET CF 3.5 is not installed"/>
<fail unless="${framework::sdk-exists( 'net-3.5' )}"
message="The .NET 3.5 SDK is not configured or not installed"/>-->
<property name="runtime.platform" value="netcf"/>
<property name="runtime.version" value="3.5"/>
<property name="runtime.config" value="netcf-3.5"/>
<property name="runtime.defines" value="NETCF,NETCF_3_5,CLR_2_0"/>
<property name="build.framework" value="net-3.5"/>
<property name="build.method" value="msbuild"/>
<property name="msbuild.proj.suffix" value="netcf-3.5"/>
</target>
<target name="set-mono-2.0-runtime-config">
<fail unless="${framework::exists( 'mono-2.0' )}"
message="Mono 2.0 is not installed"/>
<fail unless="${framework::sdk-exists( 'mono-2.0' )}"
message="The Mono 2.0 SDK is not configured or not installed"/>
<property name="runtime.platform" value="mono"/>
<property name="runtime.version" value="2.0"/>
<property name="runtime.config" value="mono-2.0"/>
<property name="runtime.defines" value="MONO,MONO_2_0,CLR_2_0"/>
<property name="build.framework" value="mono-3.5"/>
<property name="build.method" value="nant"/>
<property name="msbuild.proj.suffix" value="2.0"/>
</target>
<target name="set-mono-3.5-runtime-config">
<fail unless="${framework::exists( 'mono-3.5' )}"
message="Mono 3.5 is not installed"/>
<fail unless="${framework::sdk-exists( 'mono-3.5' )}"
message="The Mono 3.5 SDK is not configured or not installed"/>
<property name="runtime.platform" value="mono"/>
<property name="runtime.version" value="3.5"/>
<property name="runtime.config" value="mono-3.5"/>
<property name="runtime.defines" value="MONO,MONO_3_5,CLR_2_0"/>
<property name="build.framework" value="mono-3.5"/>
<property name="build.method" value="nant"/>
<property name="msbuild.proj.suffix" value="3.5"/>
</target>
<target name="set-mono-4.0-runtime-config">
<fail unless="${framework::exists( 'mono-4.0' )}"
message="Mono 4.0 is not installed"/>
<fail unless="${framework::sdk-exists( 'mono-4.0' )}"
message="The Mono 4.0 SDK is not configured or not installed"/>
<property name="runtime.platform" value="mono"/>
<property name="runtime.version" value="4.0"/>
<property name="runtime.config" value="mono-4.0"/>
<property name="runtime.defines" value="MONO,MONO_4_0,CLR_4_0"/>
<property name="build.framework" value="mono-4.0"/>
<property name="build.method" value="nant"/>
<property name="msbuild.proj.suffix" value="4.0"/>
</target>
<target name="set-silverlight-3.0-runtime-config">
<fail unless="${framework::exists( 'silverlight-3.0' )}"
message="Silverlight 3.0 is not installed"/>
<property name="runtime.platform" value="silverlight"/>
<property name="runtime.version" value="3.0"/>
<property name="runtime.config" value="silverlight-3.0"/>
<property name="runtime.defines" value="SILVERLIGHT,SL_3_0,CLR_2_0"/>
<property name="build.framework" value="silverlight-3.0"/>
<property name="build.method" value="msbuild"/>
<property name="msbuild.proj.suffix" value="sl-3.0"/>
</target>
<target name="set-silverlight-4.0-runtime-config">
<fail unless="${framework::exists( 'silverlight-4.0' )}"
message="Silverlight 4.0 is not installed"/>
<property name="runtime.platform" value="silverlight"/>
<property name="runtime.version" value="4.0"/>
<property name="runtime.config" value="silverlight-4.0"/>
<property name="runtime.defines" value="SILVERLIGHT,SL_4_0,CLR_4_0"/>
<property name="build.framework" value="silverlight-4.0"/>
<property name="build.method" value="msbuild"/>
<property name="msbuild.proj.suffix" value="sl-4.0"/>
</target>
<target name="set-silverlight-5.0-runtime-config">
<fail unless="${framework::exists( 'silverlight-5.0' )}"
message="Silverlight 5.0 is not installed"/>
<property name="runtime.platform" value="silverlight"/>
<property name="runtime.version" value="5.0"/>
<property name="runtime.config" value="silverlight-5.0"/>
<property name="runtime.defines" value="SILVERLIGHT,SL_5_0,CLR_4_0"/>
<property name="build.framework" value="silverlight-5.0"/>
<property name="build.method" value="msbuild"/>
<property name="msbuild.proj.suffix" value="sl-5.0"/>
</target>
<!-- ***************************************************************** -->
<!-- **************** Internally used targets ************************ -->
<!-- ***************************************************************** -->
<!-- Set up the build directory -->
<target name="set-build-dir"
depends="set-build-config,set-runtime-config">
<property name="runtime.platform.dir"
value="${path::combine(project.build.dir,runtime.platform)}"/>
<property name="runtime.version.dir"
value="${path::combine(runtime.platform.dir,runtime.version)}"/>
<property name="current.build.dir"
value="${path::combine(runtime.version.dir,build.config)}"/>
<property name="msbuild.dir" value="${framework::get-framework-directory(build.framework)}"/>
<property name="msbuild.exe" value="MSBuild.exe" unless="${runtime.platform == 'mono'}"/>
<property name="msbuild.exe" value="xbuild.exe" if="${runtime.platform == 'mono'}"/>
<property name="msbuild.path" value="${msbuild.dir}/${msbuild.exe}"/>
</target>
<target name="make-build-dir" depends="set-build-dir">
<mkdir dir="${current.build.dir}"
unless="${directory::exists(current.build.dir)}"/>
</target>
<target name="create-zip" description="Create zip from existing image">
<!-- Create the zip file -->
<zip zipfile="${project.package.dir}/${zip.file.name}" ziplevel="9">
<fileset basedir="${package.working.dir}">
<include name="**"/>
</fileset>
</zip>
</target>
<target name="copy-src">
<delete dir="${package.src.dir}" />
<mkdir dir="${package.src.dir}"/>
<copy todir="${package.src.dir}">
<fileset basedir="${project.src.dir}">
<include name="framework/*.csproj"/>
<include name="framework/*.snk"/>
<include name="framework/*.build"/>
<include name="framework/**/*.cs"/>
<include name="tests/*.csproj"/>
<include name="tests/**/*.cs"/>
<include name="tests/*.build"/>
<include name="testdata/*.csproj"/>
<include name="testdata/**/*.cs"/>
<include name="testdata/*.build"/>
<include name="mock-assembly/*.csproj"/>
<include name="mock-assembly/**/*.cs"/>
<include name="mock-assembly/*.build"/>
<include name="TestResultConsole/*.csproj"/>
<include name="TestResultConsole/**/*.cs"/>
<include name="TestResultConsole/*.build"/>
</fileset>
</copy>
</target>
<target name="copy-tools">
<delete dir="${package.tools.dir}" />
<mkdir dir="${package.tools.dir}"/>
<copy todir="${package.tools.dir}">
<fileset basedir="${project.tools.dir}">
<include name="**/*"/>
</fileset>
</copy>
</target>
<target name="run-subprojects">
<nant target="${current.target}" buildfile="src/framework/nunitlite.framework.build"/>
<nant target="${current.target}" buildfile="src/mock-assembly/mock-assembly.build"/>
<nant target="${current.target}" buildfile="src/testdata/nunitlite.testdata.build"/>
<nant target="${current.target}" buildfile="src/tests/nunitlite.tests.build"/>
<nant target="${current.target}" buildfile="src/runner/ci-test-runner.build"
if="${runtime.platform=='silverlight'}"/>
</target>
<!-- ***************************************************************** -->
<!-- *** Dump configuration settings for debugging *** -->
<!-- ***************************************************************** -->
<target name="dump-settings" depends="set-build-dir">
<echo>Project Directories</echo>
<echo> Base: ${project.base.dir}</echo>
<echo> Source: ${project.src.dir}</echo>
<echo> Build: ${project.build.dir}</echo>
<echo> Package: ${project.package.dir}</echo>
<echo></echo>
<echo>Supported Framework Versions</echo>
<echo> ${supported.frameworks}</echo>
<echo></echo>
<echo>Installed Framework Versions</echo>
<echo> ${installed.frameworks}</echo>
<echo></echo>
<echo>Current Configuration</echo>
<echo> Config: ${build.config}</echo>
<echo> Runtime: ${runtime.config}</echo>
<echo> VS Proj: nunitlite-${msbuild.proj.suffix}.csproj</echo>
<echo> Defines: ${build.defines}</echo>
<echo> Builder: ${msbuild.exe}</echo>
<echo> Version: ${package.version}</echo>
<echo> Package Base Name: ${package.base.name}</echo>
<echo> Package: ${package.name}</echo>
<echo></echo>
<echo>Current Working Directories</echo>
<echo> Build: ${current.build.dir}</echo>
<echo> Package: ${package.working.dir}</echo>
<echo> Source: ${package.src.dir}</echo>
<echo></echo>
<echo>Current Framework and SDK Directories</echo>
<echo> ${framework::get-framework-directory(runtime.config)}</echo>
<echo> ${framework::get-sdk-directory(runtime.config)}</echo>
</target>
</project>

Просмотреть файл

@ -0,0 +1,52 @@
<?xml version="1.0"?>
<project>
<!-- ***************************************************************** -->
<!-- *** Primary Targets *** -->
<!-- ***************************************************************** -->
<target name="clean" depends="${build.method}-clean"/>
<target name="build" depends="${build.method}-build"/>
<target name="rebuild" depends="${build.method}-rebuild"/>
<target name="nant-rebuild" depends="nant-clean,nant-build"/>
<!-- ***************************************************************** -->
<!-- *** Targets Used when Build.Method is MSBuild *** -->
<!-- ***************************************************************** -->
<target name="msbuild-clean">
<property name="msbuild.target" value="clean"/>
<call target="run-msbuild"/>
</target>
<target name="msbuild-build">
<property name="msbuild.target" value="build"/>
<call target="run-msbuild"/>
</target>
<target name="msbuild-rebuild">
<property name="msbuild.target" value="rebuild"/>
<call target="run-msbuild"/>
</target>
<target name="run-msbuild">
<exec program="${msbuild.path}">
<arg file="${msbuild.project}"/>
<arg value="/t:${msbuild.target}"/>
<arg value='/property:OutputPath="${current.build.dir}"'/>
<arg value='/property:Configuration=${build.config}'/>
</exec>
</target>
</project>

Двоичные данные
NUnitLite-1.0.0/src/.DS_Store поставляемый Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 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("TestResultConsole.cs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestResultConsole.cs")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0245d9d3-40c9-47f0-a109-31131cc0ea53")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -0,0 +1,49 @@
using System;
using System.IO;
using System.Net.Sockets;
using System.Text;
namespace TestResultConsole.cs
{
class Program
{
static int port = 9000;
static void Main(string[] args)
{
TcpListener listener = new TcpListener(port);
listener.Start();
Console.WriteLine("Waiting for test to begin...");
TcpClient client = listener.AcceptTcpClient();
Console.WriteLine("Connected to test runner...");
Console.WriteLine();
NetworkStream ns = client.GetStream();
TextReader rdr = new StreamReader(ns);
try
{
while (client.Connected)
{
string data = rdr.ReadLine();
Console.WriteLine(data);
}
}
catch (IOException e)
{
if (client.Connected)
Console.WriteLine(e.ToString());
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
client.Close();
listener.Stop();
}
}
}

Просмотреть файл

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8CB31CE4-639A-4A34-B04D-A8CE3FEBECB3}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestResultConsole</RootNamespace>
<AssemblyName>TestResultConsole</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Program.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,143 @@
// ***********************************************************************
// Copyright (c) 2011 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Reflection;
namespace NUnit.Framework.Api
{
/// <summary>
/// ExpectedExceptionData is a struct used within the framework
/// to encapsulate information about an expected exception.
/// </summary>
public struct ExpectedExceptionData
{
#region Fields
private Type expectedExceptionType;
private string expectedExceptionName;
private string expectedMessage;
private MessageMatch matchType;
private string userMessage;
private string handlerName;
private MethodInfo exceptionHandler;
#endregion
#region Properties
/// <summary>
/// The Type of any exception that is expected.
/// </summary>
public Type ExpectedExceptionType
{
get { return expectedExceptionType; }
set
{
expectedExceptionType = value;
expectedExceptionName = value.FullName;
}
}
/// <summary>
/// The FullName of any exception that is expected
/// </summary>
public string ExpectedExceptionName
{
get { return expectedExceptionName; }
set
{
expectedExceptionName = value;
expectedExceptionType = null;
}
}
/// <summary>
/// The Message of any exception that is expected
/// </summary>
public string ExpectedMessage
{
get { return expectedMessage; }
set { expectedMessage = value; }
}
/// <summary>
/// The type of match to be performed on the expected message
/// </summary>
public MessageMatch MatchType
{
get { return matchType; }
set { matchType = value; }
}
/// <summary>
/// A user message to be issued in case of error
/// </summary>
public string UserMessage
{
get { return userMessage; }
set { userMessage = value; }
}
/// <summary>
/// The name of an alternate exception handler to be
/// used to validate the exception.
/// </summary>
public string HandlerName
{
get { return handlerName; }
set
{
handlerName = value;
exceptionHandler = null;
}
}
#endregion
#region Methods
/// <summary>
/// Returns a MethodInfo for the handler to be used to
/// validate any exception thrown.
/// </summary>
/// <param name="fixtureType">The Type of the fixture.</param>
/// <returns>A MethodInfo.</returns>
public MethodInfo GetExceptionHandler(Type fixtureType)
{
if (exceptionHandler == null && handlerName != null)
{
exceptionHandler = fixtureType.GetMethod(
handlerName,
BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
null,
new Type[] { typeof(System.Exception) },
null);
}
return exceptionHandler;
}
#endregion
};
}

Просмотреть файл

@ -0,0 +1,44 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
using System.Reflection;
namespace NUnit.Framework.Api
{
/// <summary>
/// The IParameterDataSource interface is implemented by types
/// that can provide data for a test method parameter.
/// </summary>
public interface IParameterDataSource
{
/// <summary>
/// Gets an enumeration of data items for use as arguments
/// for a test method parameter.
/// </summary>
/// <param name="parameter">The parameter for which data is needed</param>
/// <returns>An enumeration containing individual data items</returns>
IEnumerable GetData(ParameterInfo parameter);
}
}

Просмотреть файл

@ -0,0 +1,162 @@
using System;
namespace NUnit.Framework.Api
{
/// <summary>
/// A PropertyBag represents a collection of name/value pairs
/// that allows duplicate entries with the same key. Methods
/// are provided for adding a new pair as well as for setting
/// a key to a single value. All keys are strings but values
/// may be of any type. Null values are not permitted, since
/// a null entry represents the absence of the key.
///
/// The entries in a PropertyBag are of two kinds: those that
/// take a single value and those that take multiple values.
/// However, the PropertyBag has no knowledge of which entries
/// fall into each category and the distinction is entirely
/// up to the code using the PropertyBag.
///
/// When working with multi-valued properties, client code
/// should use the Add method to add name/value pairs and
/// indexing to retrieve a list of all values for a given
/// key. For example:
///
/// bag.Add("Tag", "one");
/// bag.Add("Tag", "two");
/// Assert.That(bag["Tag"],
/// Is.EqualTo(new string[] { "one", "two" }));
///
/// When working with single-valued propeties, client code
/// should use the Set method to set the value and Get to
/// retrieve the value. The GetSetting methods may also be
/// used to retrieve the value in a type-safe manner while
/// also providing default. For example:
///
/// bag.Set("Priority", "low");
/// bag.Set("Priority", "high"); // replaces value
/// Assert.That(bag.Get("Priority"),
/// Is.EqualTo("high"));
/// Assert.That(bag.GetSetting("Priority", "low"),
/// Is.EqualTo("high"));
/// </summary>
public interface IPropertyBag : IXmlNodeBuilder, System.Collections.IEnumerable
{
/// <summary>
/// Get the number of key/value pairs in the property bag
/// </summary>
int Count { get; }
/// <summary>
/// Adds a key/value pair to the property bag
/// </summary>
/// <param name="key">The key</param>
/// <param name="value">The value</param>
void Add(string key, object value);
/// <summary>
/// Sets the value for a key, removing any other
/// values that are already in the property set.
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
void Set(string key, object value);
/// <summary>
/// Gets a single value for a key, using the first
/// one if multiple values are present and returning
/// null if the value is not found.
/// </summary>
object Get(string key);
/// <summary>
/// Gets a single string value for a key, using the first
/// one if multiple values are present and returning the
/// default value if no entry is found.
/// </summary>
string GetSetting(string key, string defaultValue);
/// <summary>
/// Gets a single int value for a key, using the first
/// one if multiple values are present and returning the
/// default value if no entry is found.
/// </summary>
int GetSetting(string key, int defaultValue);
/// <summary>
/// Gets a single boolean value for a key, using the first
/// one if multiple values are present and returning the
/// default value if no entry is found.
/// </summary>
bool GetSetting(string key, bool defaultValue);
/// <summary>
/// Gets a single enum value for a key, using the first
/// one if multiple values are present and returning the
/// default value if no entry is found.
/// </summary>
System.Enum GetSetting(string key, System.Enum defaultValue);
/// <summary>
/// Removes all entries for a key from the property set.
/// If the key is not found, no error occurs.
/// </summary>
/// <param name="key">The key for which the entries are to be removed</param>
void Remove(string key);
/// <summary>
/// Removes a single entry if present. If not found,
/// no error occurs.
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
void Remove(string key, object value);
/// <summary>
/// Removes a specific PropertyEntry. If the entry is not
/// found, no errr occurs.
/// </summary>
/// <param name="entry">The property entry to remove</param>
void Remove(PropertyEntry entry);
/// <summary>
/// Gets a flag indicating whether the specified key has
/// any entries in the property set.
/// </summary>
/// <param name="key">The key to be checked</param>
/// <returns>True if their are values present, otherwise false</returns>
bool ContainsKey(string key);
/// <summary>
/// Gets a flag indicating whether the specified key and
/// value are present in the property set.
/// </summary>
/// <param name="key">The key to be checked</param>
/// <param name="value">The value to be checked</param>
/// <returns>True if the key and value are present, otherwise false</returns>
bool Contains(string key, object value);
/// <summary>
/// Gets a flag indicating whether the specified key and
/// value are present in the property set.
/// </summary>
/// <param name="entry">The property entry to be checked</param>
/// <returns>True if the entry is present, otherwise false</returns>
bool Contains(PropertyEntry entry);
/// <summary>
/// Gets or sets the list of values for a particular key
/// </summary>
/// <param name="key">The key for which the values are to be retrieved or set</param>
System.Collections.IList this[string key] { get; set; }
/// <summary>
/// Gets a collection containing all the keys in the property set
/// </summary>
#if CLR_2_0 || CLR_4_0
System.Collections.Generic.ICollection<string> Keys { get; }
#else
System.Collections.ICollection Keys { get; }
#endif
}
}

Просмотреть файл

@ -0,0 +1,107 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework.Api
{
/// <summary>
/// Common interface supported by all representations
/// of a test. Only includes informational fields.
/// The Run method is specifically excluded to allow
/// for data-only representations of a test.
/// </summary>
public interface ITest : IXmlNodeBuilder
{
/// <summary>
/// Gets or sets the id of the test
/// </summary>
int Id { get; set; }
/// <summary>
/// Gets the name of the test
/// </summary>
string Name { get; }
/// <summary>
/// Gets the fully qualified name of the test
/// </summary>
string FullName { get; }
/// <summary>
/// Gets the Type of the test fixture, if applicable, or
/// null if no fixture type is associated with this test.
/// </summary>
Type FixtureType { get; }
/// <summary>
/// Indicates whether the test can be run using
/// the RunState enum.
/// </summary>
RunState RunState { get; set; }
/// <summary>
/// Count of the test cases ( 1 if this is a test case )
/// </summary>
int TestCaseCount { get; }
/// <summary>
/// Gets the properties of the test
/// </summary>
IPropertyBag Properties { get; }
/// <summary>
/// Gets the parent test, if any.
/// </summary>
/// <value>The parent test or null if none exists.</value>
ITest Parent { get; }
/// <summary>
/// Returns true if this is a test suite
/// </summary>
bool IsSuite { get; }
/// <summary>
/// Gets a bool indicating whether the current test
/// has any descendant tests.
/// </summary>
bool HasChildren { get; }
/// <summary>
/// Gets the Int value representing the seed for the RandomGenerator
/// </summary>
/// <value></value>
int Seed { get; }
/// <summary>
/// Gets this test's child tests
/// </summary>
/// <value>A list of child tests</value>
#if CLR_2_0 || CLR_4_0
System.Collections.Generic.IList<ITest> Tests { get; }
#else
System.Collections.IList Tests { get; }
#endif
}
}

Просмотреть файл

@ -0,0 +1,56 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
using System.Reflection;
using NUnit.Framework.Internal;
namespace NUnit.Framework.Api
{
/// <summary>
/// The ITestAssemblyBuilder interface is implemented by a class
/// that is able to build a suite of tests given an assembly or
/// an assembly filename.
/// </summary>
public interface ITestAssemblyBuilder
{
// TODO: Remove use of TestSuite after tests are not self-running
/// <summary>
/// Build a suite of tests from a provided assembly
/// </summary>
/// <param name="assembly">The assembly from which tests are to be built</param>
/// <param name="options">A dictionary of options to use in building the suite</param>
/// <returns>A TestSuite containing the tests found in the assembly</returns>
TestSuite Build(Assembly assembly, IDictionary options);
/// <summary>
/// Build a suite of tests given the filename of an assembly
/// </summary>
/// <param name="assemblyName">The filename of the assembly from which tests are to be built</param>
/// <param name="options">A dictionary of options to use in building the suite</param>
/// <returns>A TestSuite containing the tests found in the assembly</returns>
TestSuite Build(string assemblyName, IDictionary options);
}
}

Просмотреть файл

@ -0,0 +1,83 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Reflection;
namespace NUnit.Framework.Api
{
/// <summary>
/// The ITestAssemblyRunner interface is implemented by classes
/// that are able to execute a suite of tests loaded
/// from an assembly.
/// </summary>
public interface ITestAssemblyRunner
{
#region Properties
/// <summary>
/// Gets the tree of loaded tests, or null if
/// no tests have been loaded.
/// </summary>
ITest LoadedTest { get; }
#endregion
#region Methods
/// <summary>
/// Loads the tests found in an Assembly, returning an
/// indication of whether or not the load succeeded.
/// </summary>
/// <param name="assemblyName">File name of the assembly to load</param>
/// <param name="settings">Dictionary of settings to use in loading the test</param>
/// <returns>True if the load was successful</returns>
bool Load(string assemblyName, System.Collections.IDictionary settings);
/// <summary>
/// Loads the tests found in an Assembly, returning an
/// indication of whether or not the load succeeded.
/// </summary>
/// <param name="assembly">The assembly to load</param>
/// <param name="settings">Dictionary of settings to use in loading the test</param>
/// <returns>True if the load was successful</returns>
bool Load(Assembly assembly, System.Collections.IDictionary settings);
///// <summary>
///// Count Test Cases using a filter
///// </summary>
///// <param name="filter">The filter to apply</param>
///// <returns>The number of test cases found</returns>
//int CountTestCases(TestFilter filter);
/// <summary>
/// Run selected tests and return a test result. The test is run synchronously,
/// and the listener interface is notified as it progresses.
/// </summary>
/// <param name="listener">Interface to receive ITestListener notifications.</param>
/// <param name="filter">A test filter used to select tests to be run</param>
ITestResult Run(ITestListener listener, ITestFilter filter);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,71 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFn
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
namespace NUnit.Framework.Api
{
/// <summary>
/// The ITestCaseData interface is implemented by a class
/// that is able to return complete testcases for use by
/// a parameterized test method.
/// </summary>
public interface ITestCaseData
{
/// <summary>
/// Gets the name to be used for the test
/// </summary>
string TestName { get; }
/// <summary>
/// Gets the RunState for this test case.
/// </summary>
RunState RunState { get; }
/// <summary>
/// Gets the argument list to be provided to the test
/// </summary>
object[] Arguments { get; }
/// <summary>
/// Gets the expected result of the test case
/// </summary>
object ExpectedResult { get; }
/// <summary>
/// Returns true if an expected result has been set
/// </summary>
bool HasExpectedResult { get; }
/// <summary>
/// Gets data about any expected exception.
/// </summary>
ExpectedExceptionData ExceptionData { get; }
/// <summary>
/// Gets the property dictionary for the test case
/// </summary>
IPropertyBag Properties { get; }
}
}

Просмотреть файл

@ -0,0 +1,50 @@
// ***********************************************************************
// Copyright (c) 2010 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFn
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Reflection;
namespace NUnit.Framework.Api
{
/// <summary>
/// ITestCaseSource interface is implemented by Types that know how to
/// return a set of ITestCaseData items for use by a test method.
/// </summary>
/// <remarks>
/// This method is defined differently depending on the version of .NET.
/// </remarks>
public interface ITestCaseSource
{
/// <summary>
/// Returns a set of ITestCaseDataItems for use as arguments
/// to a parameterized test method.
/// </summary>
/// <param name="method">The method for which data is needed.</param>
/// <returns></returns>
#if CLR_2_0 || CLR_4_0
System.Collections.Generic.IEnumerable<ITestCaseData> GetTestCasesFor(MethodInfo method);
#else
System.Collections.IEnumerable GetTestCasesFor(MethodInfo method);
#endif
}
}

Просмотреть файл

@ -0,0 +1,50 @@
// ***********************************************************************
// Copyright (c) 2010 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFn
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework.Api
{
/// <summary>
/// The ITestCaseSourceProvider interface is implemented by Types that
/// are able to provide a test case source for use by a test method.
/// </summary>
public interface IDynamicTestCaseSource
{
/// <summary>
/// Returns a test case source. May be called on a provider
/// implementing the source internally or able to create
/// a source instance on it's own.
/// </summary>
/// <returns></returns>
ITestCaseSource GetTestCaseSource();
/// <summary>
/// Returns a test case source based on an instance of a
/// source object.
/// </summary>
/// <param name="instance"></param>
/// <returns></returns>
ITestCaseSource GetTestCaseSource(object instance);
}
}

Просмотреть файл

@ -0,0 +1,49 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework.Api
{
/// <summary>
/// Interface to be implemented by filters applied to tests.
/// The filter applies when running the test, after it has been
/// loaded, since this is the only time an ITest exists.
/// </summary>
public interface ITestFilter
{
/// <summary>
/// Indicates whether this is the EmptyFilter
/// </summary>
bool IsEmpty { get; }
/// <summary>
/// Determine if a particular test passes the filter criteria. Pass
/// may examine the parents and/or descendants of a test, depending
/// on the semantics of the particular filter
/// </summary>
/// <param name="test">The test to which the filter is applied</param>
/// <returns>True if the test passes the fFilter, otherwise false</returns>
bool Pass( ITest test );
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework.Api
{
/// <summary>
/// The ITestListener interface is used internally to receive
/// notifications of significant events while a test is being
/// run. The events are propogated to clients by means of an
/// AsyncCallback. NUnit extensions may also monitor these events.
/// </summary>
public interface ITestListener
{
/// <summary>
/// Called when a test has just started
/// </summary>
/// <param name="test">The test that is starting</param>
void TestStarted(ITest test);
/// <summary>
/// Called when a test has finished
/// </summary>
/// <param name="result">The result of the test</param>
void TestFinished(ITestResult result);
/// <summary>
/// Called when the test creates text output.
/// </summary>
/// <param name="testOutput">A console message</param>
void TestOutput(TestOutput testOutput);
}
}

Просмотреть файл

@ -0,0 +1,161 @@
// ***********************************************************************
// Copyright (c) 2010 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework.Api
{
/// <summary>
/// The ITestResult interface represents the result of a test.
/// </summary>
public interface ITestResult : IXmlNodeBuilder
{
/// <summary>
/// Gets the ResultState of the test result, which
/// indicates the success or failure of the test.
/// </summary>
ResultState ResultState
{
get;
}
/// <summary>
/// Gets the name of the test result
/// </summary>
string Name
{
get;
}
/// <summary>
/// Gets the full name of the test result
/// </summary>
string FullName
{
get;
}
/// <summary>
/// Gets the elapsed time for running the test
/// </summary>
TimeSpan Duration
{
get;
}
/// <summary>
/// Gets the message associated with a test
/// failure or with not running the test
/// </summary>
string Message
{
get;
}
/// <summary>
/// Gets any stacktrace associated with an
/// error or failure. Not available in
/// the Compact Framework 1.0.
/// </summary>
string StackTrace
{
get;
}
/// <summary>
/// Gets the number of asserts executed
/// when running the test and all its children.
/// </summary>
int AssertCount
{
get;
}
/// <summary>
/// Gets the number of test cases that failed
/// when running the test and all its children.
/// </summary>
int FailCount
{
get;
}
/// <summary>
/// Gets the number of test cases that passed
/// when running the test and all its children.
/// </summary>
int PassCount
{
get;
}
/// <summary>
/// Gets the number of test cases that were skipped
/// when running the test and all its children.
/// </summary>
int SkipCount
{
get;
}
/// <summary>
/// Gets the number of test cases that were inconclusive
/// when running the test and all its children.
/// </summary>
int InconclusiveCount
{
get;
}
/// <summary>
/// Indicates whether this result has any child results.
/// Accessing HasChildren should not force creation of the
/// Children collection in classes implementing this interface.
/// </summary>
bool HasChildren
{
get;
}
/// <summary>
/// Gets the the collection of child results.
/// </summary>
#if CLR_2_0 || CLR_4_0
System.Collections.Generic.IList<ITestResult> Children
#else
System.Collections.IList Children
#endif
{
get;
}
/// <summary>
/// Gets the Test to which this result applies.
/// </summary>
ITest Test
{
get;
}
}
}

Просмотреть файл

@ -0,0 +1,29 @@
using System;
namespace NUnit.Framework.Api
{
/// <summary>
/// An object implementing IXmlNodeBuilder is able to build
/// an XmlResult representation of itself and any children.
/// Note that the interface refers to the implementation
/// of XmlNode in the NUnit.Framework.Api namespace.
/// </summary>
public interface IXmlNodeBuilder
{
/// <summary>
/// Returns an XmlNode representating the current object.
/// </summary>
/// <param name="recursive">If true, children are included where applicable</param>
/// <returns>An XmlNode representing the result</returns>
XmlNode ToXml(bool recursive);
/// <summary>
/// Returns an XmlNode representing the current object after
/// adding it as a child of the supplied parent node.
/// </summary>
/// <param name="parentNode">The parent node.</param>
/// <param name="recursive">If true, children are included, where applicable</param>
/// <returns></returns>
XmlNode AddToXml(XmlNode parentNode, bool recursive);
}
}

Просмотреть файл

@ -0,0 +1,70 @@
// ***********************************************************************
// Copyright (c) 2010 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework.Api
{
/// <summary>
/// Immutable class that stores a property entry as a Name/Value pair.
/// </summary>
public class PropertyEntry
{
private readonly string name;
private readonly object value;
/// <summary>
/// Initializes a new immutable instance of the <see cref="PropertyEntry"/> class.
/// </summary>
/// <param name="name"></param>
/// <param name="value"></param>
public PropertyEntry(string name, object value)
{
this.name = name;
this.value = value;
}
/// <summary>Name of the PropertyEntry.</summary>
public string Name
{
get { return name; }
}
/// <summary>Value of the PropertyEntry.</summary>
public object Value
{
get { return value; }
}
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
return string.Format("{0}={1}", name, value);
}
}
}

Просмотреть файл

@ -0,0 +1,139 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework.Api
{
/// <summary>
/// The ResultState class represents the outcome of running a test.
/// It contains two pieces of information. The Status of the test
/// is an enum indicating whether the test passed, failed, was
/// skipped or was inconclusive. The Label provides a more
/// detailed breakdown for use by client runners.
/// </summary>
public class ResultState
{
private readonly TestStatus status;
private readonly string label;
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ResultState"/> class.
/// </summary>
/// <param name="status">The TestStatus.</param>
public ResultState(TestStatus status) : this (status, string.Empty)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ResultState"/> class.
/// </summary>
/// <param name="status">The TestStatus.</param>
/// <param name="label">The label.</param>
public ResultState(TestStatus status, string label)
{
this.status = status;
this.label = label == null ? string.Empty : label;
}
#endregion
#region Predefined ResultStates
/// <summary>
/// The result is inconclusive
/// </summary>
public readonly static ResultState Inconclusive = new ResultState(TestStatus.Inconclusive);
/// <summary>
/// The test was not runnable.
/// </summary>
public readonly static ResultState NotRunnable = new ResultState(TestStatus.Skipped, "Invalid");
/// <summary>
/// The test has been skipped.
/// </summary>
public readonly static ResultState Skipped = new ResultState(TestStatus.Skipped);
/// <summary>
/// The test has been ignored.
/// </summary>
public readonly static ResultState Ignored = new ResultState(TestStatus.Skipped, "Ignored");
/// <summary>
/// The test succeeded
/// </summary>
public readonly static ResultState Success = new ResultState(TestStatus.Passed);
/// <summary>
/// The test failed
/// </summary>
public readonly static ResultState Failure = new ResultState(TestStatus.Failed);
/// <summary>
/// The test encountered an unexpected exception
/// </summary>
public readonly static ResultState Error = new ResultState(TestStatus.Failed, "Error");
/// <summary>
/// The test was cancelled by the user
/// </summary>
public readonly static ResultState Cancelled = new ResultState(TestStatus.Failed, "Cancelled");
#endregion
#region Properties
/// <summary>
/// Gets the TestStatus for the test.
/// </summary>
/// <value>The status.</value>
public TestStatus Status
{
get { return status; }
}
/// <summary>
/// Gets the label under which this test resullt is
/// categorized, if any.
/// </summary>
public string Label
{
get { return label; }
}
#endregion
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
string s = status.ToString();
return label == null || label.Length == 0 ? s : string.Format("{0}:{1}", s, label);
}
}
}

Просмотреть файл

@ -0,0 +1,60 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework.Api
{
/// <summary>
/// The RunState enum indicates whether a test
/// can be executed.
/// </summary>
public enum RunState
{
/// <summary>
/// The test is not runnable.
/// </summary>
NotRunnable,
/// <summary>
/// The test is runnable.
/// </summary>
Runnable,
/// <summary>
/// The test can only be run explicitly.
/// </summary>
Explicit,
/// <summary>
/// The test has been skipped. This value may
/// appear on a Test when certain attributes
/// are used to skip the test.
/// </summary>
Skipped,
/// <summary>
/// The test has been ignored. May appear on
/// a Test, when the IgnoreAttribute is used.
/// </summary>
Ignored
}
}

Просмотреть файл

@ -0,0 +1,109 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework.Api
{
using System;
/// <summary>
/// The TestOutput class holds a unit of output from
/// a test to either stdOut or stdErr
/// </summary>
public class TestOutput
{
string text;
TestOutputType type;
/// <summary>
/// Construct with text and an ouput destination type
/// </summary>
/// <param name="text">Text to be output</param>
/// <param name="type">Destination of output</param>
public TestOutput(string text, TestOutputType type)
{
this.text = text;
this.type = type;
}
/// <summary>
/// Return string representation of the object for debugging
/// </summary>
/// <returns></returns>
public override string ToString()
{
return type + ": " + text;
}
/// <summary>
/// Get the text
/// </summary>
public string Text
{
get
{
return this.text;
}
}
/// <summary>
/// Get the output type
/// </summary>
public TestOutputType Type
{
get
{
return this.type;
}
}
}
/// <summary>
/// Enum representing the output destination
/// It uses combinable flags so that a given
/// output control can accept multiple types
/// of output. Normally, each individual
/// output uses a single flag value.
/// </summary>
public enum TestOutputType
{
/// <summary>
/// Send output to stdOut
/// </summary>
Out,
/// <summary>
/// Send output to stdErr
/// </summary>
Error,
/// <summary>
/// Send output to Trace
/// </summary>
Trace,
/// <summary>
/// Send output to Log
/// </summary>
Log
}
}

Просмотреть файл

@ -0,0 +1,51 @@
// ***********************************************************************
// Copyright (c) 2010 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework.Api
{
/// <summary>
/// The TestStatus enum indicates the result of running a test
/// </summary>
public enum TestStatus
{
/// <summary>
/// The test was inconclusive
/// </summary>
Inconclusive,
/// <summary>
/// The test has skipped
/// </summary>
Skipped,
/// <summary>
/// The test succeeded
/// </summary>
Passed,
/// <summary>
/// The test failed
/// </summary>
Failed
}
}

Просмотреть файл

@ -0,0 +1,352 @@
// ***********************************************************************
// Copyright (c) 2012 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework.Api
{
/// <summary>
/// XmlNode represents a single node in the XML representation
/// of a Test or TestResult. It replaces System.Xml.XmlNode and
/// provides a minimal set of methods for operating on the XML
/// in a platform-independent manner.
/// </summary>
public class XmlNode
{
#region Private Fields
private string name;
private AttributeDictionary attributes;
private NodeList childNodes;
private string textContent;
#endregion
#region Constructors
/// <summary>
/// Constructs a new instance of XmlNode
/// </summary>
/// <param name="name">The name of the node</param>
public XmlNode(string name)
{
this.name = name;
this.attributes = new AttributeDictionary();
this.childNodes = new NodeList();
}
#endregion
#region Static Methods
/// <summary>
/// Creates a new top level element node.
/// </summary>
/// <param name="name">The element name.</param>
/// <returns></returns>
public static XmlNode CreateTopLevelElement(string name)
{
return new XmlNode(name);
}
#endregion
#region Properties
/// <summary>
/// Gets the name of the node
/// </summary>
public string Name
{
get { return name; }
}
/// <summary>
/// Gets the text content of the node
/// </summary>
public string TextContent
{
get { return textContent; }
set { textContent = value; }
}
/// <summary>
/// Gets the text content of the node escaped as needed.
/// This is for use in writing out the XML representation.
/// </summary>
public string EscapedTextContent
{
get { return Escape(textContent); }
}
/// <summary>
/// Gets the dictionary of attributes
/// </summary>
public AttributeDictionary Attributes
{
get { return attributes; }
}
/// <summary>
/// Gets a list of child nodes
/// </summary>
public NodeList ChildNodes
{
get { return childNodes; }
}
/// <summary>
/// Gets the first child of this node, or null
/// </summary>
public XmlNode FirstChild
{
get
{
return ChildNodes.Count > 0
? ChildNodes[0] as XmlNode
: null;
}
}
#endregion
#region Instance Methods
/// <summary>
/// Adds a new element as a child of the current node and returns it.
/// </summary>
/// <param name="name">The element name.</param>
/// <returns>The newly created child element</returns>
public XmlNode AddElement(string name)
{
XmlNode childResult = new XmlNode(name);
ChildNodes.Add(childResult);
return childResult;
}
/// <summary>
/// Adds an attribute with a specified name and value to the XmlNode.
/// </summary>
/// <param name="name">The name of the attribute.</param>
/// <param name="value">The value of the attribute.</param>
public void AddAttribute(string name, string value)
{
this.Attributes.Add(name, value);
}
/// <summary>
/// Finds a single descendant of this node matching an xpath
/// specification. The format of the specification is
/// limited to what is needed by NUnit and its tests.
/// </summary>
/// <param name="xpath"></param>
/// <returns></returns>
public XmlNode FindDescendant(string xpath)
{
NodeList nodes = FindDescendants(xpath);
return nodes.Count > 0
? nodes[0] as XmlNode
: null;
}
/// <summary>
/// Finds all descendants of this node matching an xpath
/// specification. The format of the specification is
/// limited to what is needed by NUnit and its tests.
/// </summary>
/// <param name="xpath"></param>
/// <returns></returns>
public NodeList FindDescendants(string xpath)
{
NodeList nodeList = new NodeList();
nodeList.Add(this);
return ApplySelection(nodeList, xpath);
}
/// <summary>
/// Writes the XML representation of the node to an XmlWriter
/// </summary>
/// <param name="writer"></param>
public void WriteTo(System.Xml.XmlWriter writer)
{
writer.WriteStartElement(this.Name);
foreach (string name in this.Attributes.Keys)
writer.WriteAttributeString(name, Attributes[name]);
if (this.TextContent != null)
writer.WriteChars(this.TextContent.ToCharArray(), 0, this.TextContent.Length);
foreach (XmlNode node in this.ChildNodes)
node.WriteTo(writer);
writer.WriteEndElement();
}
#endregion
#region Helper Methods
private static NodeList ApplySelection(NodeList nodeList, string xpath)
{
Guard.ArgumentNotNullOrEmpty(xpath, "xpath");
if (xpath[0] == '/')
throw new ArgumentException("XPath expressions starting with '/' are not supported", "xpath");
if (xpath.IndexOf("//") >= 0)
throw new ArgumentException("XPath expressions with '//' are not supported", "xpath");
string head = xpath;
string tail = null;
int slash = xpath.IndexOf('/');
if (slash >= 0)
{
head = xpath.Substring(0, slash);
tail = xpath.Substring(slash + 1);
}
NodeList resultNodes = new NodeList();
NodeFilter filter = new NodeFilter(head);
foreach(XmlNode node in nodeList)
foreach (XmlNode childNode in node.ChildNodes)
if (filter.Pass(childNode))
resultNodes.Add(childNode);
return tail != null
? ApplySelection(resultNodes, tail)
: resultNodes;
}
private static string Escape(string original)
{
return original
.Replace("&", "&amp;")
.Replace("\"", "&quot;")
.Replace("'", "&apos;")
.Replace("<", "&lt;")
.Replace(">", "&gt;");
}
#endregion
#region Nested NodeFilter class
class NodeFilter
{
private string nodeName;
private string propName;
private string propValue;
public NodeFilter(string xpath)
{
this.nodeName = xpath;
int lbrack = xpath.IndexOf('[');
if (lbrack >= 0)
{
if (!xpath.EndsWith("]"))
throw new ArgumentException("Invalid property expression", "xpath");
nodeName = xpath.Substring(0, lbrack);
string filter = xpath.Substring(lbrack+1, xpath.Length - lbrack - 2);
int equals = filter.IndexOf('=');
if (equals < 0 || filter[0] != '@')
throw new ArgumentException("Invalid property expression", "xpath");
this.propName = filter.Substring(1, equals - 1).Trim();
this.propValue = filter.Substring(equals + 1).Trim(new char[] { ' ', '"', '\'' });
}
}
public bool Pass(XmlNode node)
{
if (node.Name != nodeName)
return false;
if (propName == null)
return true;
return (string)node.Attributes[propName] == propValue;
}
}
#endregion
}
/// <summary>
/// Class used to represent a list of XmlResults
/// </summary>
#if CLR_2_0 || CLR_4_0
public class NodeList : System.Collections.Generic.List<XmlNode>
{
}
#else
public class NodeList : System.Collections.ArrayList
{
}
#endif
/// <summary>
/// Class used to represent the attributes of a node
/// </summary>
#if CLR_2_0 || CLR_4_0
public class AttributeDictionary : System.Collections.Generic.Dictionary<string, string>
{
}
#else
public class AttributeDictionary : System.Collections.Specialized.StringDictionary
{
private System.Collections.ArrayList orderedKeys = new System.Collections.ArrayList();
/// <summary>
/// Adds a key and value to the dictionary. Overridden to
/// save the order in which keys are added.
/// </summary>
/// <param name="key">The attribute key</param>
/// <param name="value">The attribute value</param>
public override void Add(string key, string value)
{
base.Add(key, value);
orderedKeys.Add(key);
}
/// <summary>
/// Gets the keys in the same order they were added.
/// </summary>
public override System.Collections.ICollection Keys
{
get
{
return orderedKeys;
}
}
}
#endif
}

Просмотреть файл

@ -0,0 +1,110 @@
// ***********************************************************************
// Copyright (c) 2012 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System;
// 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("NUnitLite")]
[assembly: AssemblyDescription("NUnitLite unit-testing framework")]
[assembly: AssemblyCompany("NUnit Software")]
[assembly: AssemblyProduct("NUnitLite")]
[assembly: AssemblyCopyright("Copyright 2013, Charlie Poole")]
[assembly: AssemblyTrademark("NUnitLite")]
[assembly: AssemblyCulture("")]
// Set AssemblyConfiguration attribute depending on
// how we are building the assembly.
#if DEBUG
#if NET_4_5
[assembly: AssemblyConfiguration(".NET 4.5 Debug")]
#elif NET_4_0
[assembly: AssemblyConfiguration(".NET 4.0 Debug")]
#elif NET_3_5
[assembly: AssemblyConfiguration(".NET 3.5 Debug")]
#elif NET_2_0
[assembly: AssemblyConfiguration(".NET 2.0 Debug")]
#elif NET_1_1
[assembly: AssemblyConfiguration(".NET 1.1 Debug")]
#elif NETCF_3_5
[assembly: AssemblyConfiguration(".NET CF 3.5 Debug")]
#elif NETCF_2_0
[assembly: AssemblyConfiguration(".NET CF 2.0 Debug")]
#elif SL_5_0
[assembly: AssemblyConfiguration("Silverlight 5.0 Debug")]
#elif SL_4_0
[assembly: AssemblyConfiguration("Silverlight 4.0 Debug")]
#elif SL_3_0
[assembly: AssemblyConfiguration("Silverlight 3.0 Debug")]
#endif
#else
#if NET_4_5
[assembly: AssemblyConfiguration(".NET 4.5")]
#elif NET_4_0
[assembly: AssemblyConfiguration(".NET 4.0")]
#elif NET_3_5
[assembly: AssemblyConfiguration(".NET 3.5")]
#elif NET_2_0
[assembly: AssemblyConfiguration(".NET 2.0")]
#elif NET_1_1
[assembly: AssemblyConfiguration(".NET 1.1")]
#elif NETCF_3_5
[assembly: AssemblyConfiguration(".NET CF 3.5")]
#elif NETCF_2_0
[assembly: AssemblyConfiguration(".NET CF 2.0")]
#elif SL_5_0
[assembly: AssemblyConfiguration("Silverlight 5.0")]
#elif SL_4_0
[assembly: AssemblyConfiguration("Silverlight 4.0")]
#elif SL_3_0
[assembly: AssemblyConfiguration("Silverlight 3.0")]
#endif
#endif
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0be367fd-d825-4039-a70b-54a3557170ec")]
// 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("1.0.0.0")]
#if !PocketPC && !WindowsCE && !NETCF
[assembly: AssemblyFileVersion("1.0.0.0")]
#endif

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,366 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System.Collections;
using NUnit.Framework.Constraints;
namespace NUnit.Framework
{
/// <summary>
/// AssertionHelper is an optional base class for user tests,
/// allowing the use of shorter names for constraints and
/// asserts and avoiding conflict with the definition of
/// <see cref="Is"/>, from which it inherits much of its
/// behavior, in certain mock object frameworks.
/// </summary>
public class AssertionHelper : ConstraintFactory
{
#region Assert
//private Assertions assert = new Assertions();
//public virtual Assertions Assert
//{
// get { return assert; }
//}
#endregion
#region Expect
#region Object
#if !CLR_2_0 && !CLR_4_0
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure. Works
/// identically to Assert.That.
/// </summary>
/// <param name="actual">The actual value to test</param>
/// <param name="expression">A Constraint to be applied</param>
public void Expect(object actual, IResolveConstraint expression)
{
Assert.That(actual, expression, null, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure. Works
/// identically to Assert.That.
/// </summary>
/// <param name="actual">The actual value to test</param>
/// <param name="expression">A Constraint to be applied</param>
/// <param name="message">The message to be displayed in case of failure</param>
public void Expect(object actual, IResolveConstraint expression, string message)
{
Assert.That(actual, expression, message, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure. Works
/// identically to Assert.That.
/// </summary>
/// <param name="actual">The actual value to test</param>
/// <param name="expression">A Constraint to be applied</param>
/// <param name="message">The message to be displayed in case of failure</param>
/// <param name="args">Arguments to use in formatting the message</param>
public void Expect(object actual, IResolveConstraint expression, string message, params object[] args)
{
Assert.That(actual, expression, message, args);
}
#endif
#endregion
#region Boolean
/// <summary>
/// Asserts that a condition is true. If the condition is false the method throws
/// an <see cref="AssertionException"/>. Works Identically to
/// <see cref="Assert.That(bool, string, object[])"/>.
/// </summary>
/// <param name="condition">The evaluated condition</param>
/// <param name="message">The message to display if the condition is false</param>
/// <param name="args">Arguments to be used in formatting the message</param>
public void Expect(bool condition, string message, params object[] args)
{
Assert.That(condition, Is.True, message, args);
}
/// <summary>
/// Asserts that a condition is true. If the condition is false the method throws
/// an <see cref="AssertionException"/>. Works Identically to
/// <see cref="Assert.That(bool, string)"/>.
/// </summary>
/// <param name="condition">The evaluated condition</param>
/// <param name="message">The message to display if the condition is false</param>
public void Expect(bool condition, string message)
{
Assert.That(condition, Is.True, message, null);
}
/// <summary>
/// Asserts that a condition is true. If the condition is false the method throws
/// an <see cref="AssertionException"/>. Works Identically to <see cref="Assert.That(bool)"/>.
/// </summary>
/// <param name="condition">The evaluated condition</param>
public void Expect(bool condition)
{
Assert.That(condition, Is.True, null, null);
}
#endregion
#region ref Boolean
#if !CLR_2_0 && !CLR_4_0
/// <summary>
/// Apply a constraint to a referenced boolean, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="constraint">A Constraint to be applied</param>
/// <param name="actual">The actual value to test</param>
public void Expect(ref bool actual, IResolveConstraint constraint)
{
Assert.That(ref actual, constraint.Resolve(), null, null);
}
/// <summary>
/// Apply a constraint to a referenced value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="constraint">A Constraint to be applied</param>
/// <param name="actual">The actual value to test</param>
/// <param name="message">The message that will be displayed on failure</param>
public void Expect(ref bool actual, IResolveConstraint constraint, string message)
{
Assert.That(ref actual, constraint.Resolve(), message, null);
}
/// <summary>
/// Apply a constraint to a referenced value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="actual">The actual value to test</param>
/// <param name="expression">A Constraint expression to be applied</param>
/// <param name="message">The message that will be displayed on failure</param>
/// <param name="args">Arguments to be used in formatting the message</param>
public void Expect(ref bool actual, IResolveConstraint expression, string message, params object[] args)
{
Assert.That(ref actual, expression, message, args);
}
#endif
#endregion
#region ActualValueDelegate
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
public void Expect<T>(ActualValueDelegate<T> del, IResolveConstraint expr)
{
Assert.That(del, expr.Resolve(), null, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
/// <param name="message">The message that will be displayed on failure</param>
public void Expect<T>(ActualValueDelegate<T> del, IResolveConstraint expr, string message)
{
Assert.That(del, expr.Resolve(), message, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="message">The message that will be displayed on failure</param>
/// <param name="args">Arguments to be used in formatting the message</param>
public void Expect<T>(ActualValueDelegate<T> del, IResolveConstraint expr, string message, params object[] args)
{
Assert.That(del, expr, message, args);
}
#else
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
public void Expect(ActualValueDelegate del, IResolveConstraint expr)
{
Assert.That(del, expr.Resolve(), null, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
/// <param name="message">The message that will be displayed on failure</param>
public void Expect(ActualValueDelegate del, IResolveConstraint expr, string message)
{
Assert.That(del, expr.Resolve(), message, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="message">The message that will be displayed on failure</param>
/// <param name="args">Arguments to be used in formatting the message</param>
public void Expect(ActualValueDelegate del, IResolveConstraint expr, string message, params object[] args)
{
Assert.That(del, expr, message, args);
}
#endif
#endregion
#region ref Object
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Apply a constraint to a referenced value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="actual">The actual value to test</param>
/// <param name="expression">A Constraint to be applied</param>
public void Expect<T>(ref T actual, IResolveConstraint expression)
{
Assert.That(ref actual, expression, null, null);
}
/// <summary>
/// Apply a constraint to a referenced value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="actual">The actual value to test</param>
/// <param name="expression">A Constraint to be applied</param>
/// <param name="message">The message that will be displayed on failure</param>
public void Expect<T>(ref T actual, IResolveConstraint expression, string message)
{
Assert.That(ref actual, expression, message, null);
}
/// <summary>
/// Apply a constraint to a referenced value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="actual">The actual value to test</param>
/// <param name="expression">A Constraint to be applied</param>
/// <param name="message">The message that will be displayed on failure</param>
/// <param name="args">Arguments to be used in formatting the message</param>
public void Expect<T>(ref T actual, IResolveConstraint expression, string message, params object[] args)
{
Assert.That(ref actual, expression, message, args);
}
#endif
#endregion
#region TestDelegate
/// <summary>
/// Asserts that the code represented by a delegate throws an exception
/// that satisfies the constraint provided.
/// </summary>
/// <param name="code">A TestDelegate to be executed</param>
/// <param name="constraint">A ThrowsConstraint used in the test</param>
public void Expect(TestDelegate code, IResolveConstraint constraint)
{
Assert.That((object)code, constraint);
}
#endregion
#endregion
#region Expect<T>
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="expression">A Constraint to be applied</param>
/// <param name="actual">The actual value to test</param>
static public void Expect<T>(T actual, IResolveConstraint expression)
{
Assert.That(actual, expression, null, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="expression">A Constraint to be applied</param>
/// <param name="actual">The actual value to test</param>
/// <param name="message">The message that will be displayed on failure</param>
static public void Expect<T>(T actual, IResolveConstraint expression, string message)
{
Assert.That(actual, expression, message, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure.
/// </summary>
/// <param name="expression">A Constraint expression to be applied</param>
/// <param name="actual">The actual value to test</param>
/// <param name="message">The message that will be displayed on failure</param>
/// <param name="args">Arguments to be used in formatting the message</param>
static public void Expect<T>(T actual, IResolveConstraint expression, string message, params object[] args)
{
Assert.That(actual, expression, message, args);
}
#endif
#endregion
#region Map
/// <summary>
/// Returns a ListMapper based on a collection.
/// </summary>
/// <param name="original">The original collection</param>
/// <returns></returns>
public ListMapper Map( ICollection original )
{
return new ListMapper( original );
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,360 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.ComponentModel;
using NUnit.Framework.Constraints;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// Provides static methods to express the assumptions
/// that must be met for a test to give a meaningful
/// result. If an assumption is not met, the test
/// should produce an inconclusive result.
/// </summary>
public class Assume
{
#region Equals and ReferenceEquals
/// <summary>
/// The Equals method throws an AssertionException. This is done
/// to make sure there is no mistake by calling this function.
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
[EditorBrowsable(EditorBrowsableState.Never)]
public static new bool Equals(object a, object b)
{
// TODO: This should probably be InvalidOperationException
throw new AssertionException("Assert.Equals should not be used for Assertions");
}
/// <summary>
/// override the default ReferenceEquals to throw an AssertionException. This
/// implementation makes sure there is no mistake in calling this function
/// as part of Assert.
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
public static new void ReferenceEquals(object a, object b)
{
throw new AssertionException("Assert.ReferenceEquals should not be used for Assertions");
}
#endregion
#region Assume.That
#region Object
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expression">A Constraint expression to be applied</param>
/// <param name="actual">The actual value to test</param>
static public void That(object actual, IResolveConstraint expression)
{
Assume.That(actual, expression, null, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expression">A Constraint expression to be applied</param>
/// <param name="actual">The actual value to test</param>
/// <param name="message">The message that will be displayed on failure</param>
static public void That(object actual, IResolveConstraint expression, string message)
{
Assume.That(actual, expression, message, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expression">A Constraint expression to be applied</param>
/// <param name="actual">The actual value to test</param>
/// <param name="message">The message that will be displayed on failure</param>
/// <param name="args">Arguments to be used in formatting the message</param>
static public void That(object actual, IResolveConstraint expression, string message, params object[] args)
{
Constraint constraint = expression.Resolve();
if (!constraint.Matches(actual))
{
MessageWriter writer = new TextMessageWriter(message, args);
constraint.WriteMessageTo(writer);
throw new InconclusiveException(writer.ToString());
}
}
#endregion
#region Boolean
/// <summary>
/// Asserts that a condition is true. If the condition is false the method throws
/// an <see cref="InconclusiveException"/>.
/// </summary>
/// <param name="condition">The evaluated condition</param>
/// <param name="message">The message to display if the condition is false</param>
/// <param name="args">Arguments to be used in formatting the message</param>
static public void That(bool condition, string message, params object[] args)
{
Assume.That(condition, Is.True, message, args);
}
/// <summary>
/// Asserts that a condition is true. If the condition is false the method throws
/// an <see cref="InconclusiveException"/>.
/// </summary>
/// <param name="condition">The evaluated condition</param>
/// <param name="message">The message to display if the condition is false</param>
static public void That(bool condition, string message)
{
Assume.That(condition, Is.True, message, null);
}
/// <summary>
/// Asserts that a condition is true. If the condition is false the
/// method throws an <see cref="InconclusiveException"/>.
/// </summary>
/// <param name="condition">The evaluated condition</param>
static public void That(bool condition)
{
Assume.That(condition, Is.True, null, null);
}
#endregion
#region ref Boolean
#if !CLR_2_0 && !CLR_4_0
/// <summary>
/// Apply a constraint to a referenced boolean, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expression">A Constraint expression to be applied</param>
/// <param name="actual">The actual value to test</param>
static public void That(ref bool actual, IResolveConstraint expression)
{
Assume.That(ref actual, expression.Resolve(), null, null);
}
/// <summary>
/// Apply a constraint to a referenced boolean, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expression">A Constraint expression to be applied</param>
/// <param name="actual">The actual value to test</param>
/// <param name="message">The message that will be displayed on failure</param>
static public void That(ref bool actual, IResolveConstraint expression, string message)
{
Assume.That(ref actual, expression.Resolve(), message, null);
}
/// <summary>
/// Apply a constraint to a referenced boolean, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="actual">The actual value to test</param>
/// <param name="expression">A Constraint expression to be applied</param>
/// <param name="message">The message that will be displayed on failure</param>
/// <param name="args">Arguments to be used in formatting the message</param>
static public void That(ref bool actual, IResolveConstraint expression, string message, params object[] args)
{
Constraint constraint = expression.Resolve();
if (!constraint.Matches(ref actual))
{
MessageWriter writer = new TextMessageWriter(message, args);
constraint.WriteMessageTo(writer);
throw new InconclusiveException(writer.ToString());
}
}
#endif
#endregion
#region ActualValueDelegate
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
static public void That<T>(ActualValueDelegate<T> del, IResolveConstraint expr)
{
Assume.That(del, expr.Resolve(), null, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
/// <param name="message">The message that will be displayed on failure</param>
static public void That<T>(ActualValueDelegate<T> del, IResolveConstraint expr, string message)
{
Assume.That(del, expr.Resolve(), message, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="message">The message that will be displayed on failure</param>
/// <param name="args">Arguments to be used in formatting the message</param>
static public void That<T>(ActualValueDelegate<T> del, IResolveConstraint expr, string message, params object[] args)
{
Constraint constraint = expr.Resolve();
if (!constraint.Matches(del))
{
MessageWriter writer = new TextMessageWriter(message, args);
constraint.WriteMessageTo(writer);
throw new InconclusiveException(writer.ToString());
}
}
#else
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
static public void That(ActualValueDelegate del, IResolveConstraint expr)
{
Assume.That(del, expr.Resolve(), null, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
/// <param name="message">The message that will be displayed on failure</param>
static public void That(ActualValueDelegate del, IResolveConstraint expr, string message)
{
Assume.That(del, expr.Resolve(), message, null);
}
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="del">An ActualValueDelegate returning the value to be tested</param>
/// <param name="expr">A Constraint expression to be applied</param>
/// <param name="message">The message that will be displayed on failure</param>
/// <param name="args">Arguments to be used in formatting the message</param>
static public void That(ActualValueDelegate del, IResolveConstraint expr, string message, params object[] args)
{
Constraint constraint = expr.Resolve();
if (!constraint.Matches(del))
{
MessageWriter writer = new TextMessageWriter(message, args);
constraint.WriteMessageTo(writer);
throw new InconclusiveException(writer.ToString());
}
}
#endif
#endregion
#region ref Object
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Apply a constraint to a referenced value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expression">A Constraint expression to be applied</param>
/// <param name="actual">The actual value to test</param>
static public void That<T>(ref T actual, IResolveConstraint expression)
{
Assume.That(ref actual, expression.Resolve(), null, null);
}
/// <summary>
/// Apply a constraint to a referenced value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expression">A Constraint expression to be applied</param>
/// <param name="actual">The actual value to test</param>
/// <param name="message">The message that will be displayed on failure</param>
static public void That<T>(ref T actual, IResolveConstraint expression, string message)
{
Assume.That(ref actual, expression.Resolve(), message, null);
}
/// <summary>
/// Apply a constraint to a referenced value, succeeding if the constraint
/// is satisfied and throwing an InconclusiveException on failure.
/// </summary>
/// <param name="expression">A Constraint expression to be applied</param>
/// <param name="actual">The actual value to test</param>
/// <param name="message">The message that will be displayed on failure</param>
/// <param name="args">Arguments to be used in formatting the message</param>
static public void That<T>(ref T actual, IResolveConstraint expression, string message, params object[] args)
{
Constraint constraint = expression.Resolve();
if (!constraint.Matches(ref actual))
{
MessageWriter writer = new TextMessageWriter(message, args);
constraint.WriteMessageTo(writer);
throw new InconclusiveException(writer.ToString());
}
}
#endif
#endregion
#region TestDelegate
/// <summary>
/// Asserts that the code represented by a delegate throws an exception
/// that satisfies the constraint provided.
/// </summary>
/// <param name="code">A TestDelegate to be executed</param>
/// <param name="constraint">A ThrowsConstraint used in the test</param>
static public void That(TestDelegate code, IResolveConstraint constraint)
{
Assume.That((object)code, constraint);
}
#endregion
#endregion
}
}

Просмотреть файл

@ -0,0 +1,95 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// Attribute used to apply a category to a test
/// </summary>
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true, Inherited=true)]
public class CategoryAttribute : NUnitAttribute, IApplyToTest
{
/// <summary>
/// The name of the category
/// </summary>
protected string categoryName;
/// <summary>
/// Construct attribute for a given category based on
/// a name. The name may not contain the characters ',',
/// '+', '-' or '!'. However, this is not checked in the
/// constructor since it would cause an error to arise at
/// as the test was loaded without giving a clear indication
/// of where the problem is located. The error is handled
/// in NUnitFramework.cs by marking the test as not
/// runnable.
/// </summary>
/// <param name="name">The name of the category</param>
public CategoryAttribute(string name)
{
this.categoryName = name.Trim();
}
/// <summary>
/// Protected constructor uses the Type name as the name
/// of the category.
/// </summary>
protected CategoryAttribute()
{
this.categoryName = this.GetType().Name;
if ( categoryName.EndsWith( "Attribute" ) )
categoryName = categoryName.Substring( 0, categoryName.Length - 9 );
}
/// <summary>
/// The name of the category
/// </summary>
public string Name
{
get { return categoryName; }
}
#region IApplyToTest Members
/// <summary>
/// Modifies a test by adding a category to it.
/// </summary>
/// <param name="test">The test to modify</param>
public void ApplyToTest(Test test)
{
test.Properties.Add(PropertyNames.Category, this.Name);
if (this.Name.IndexOfAny(new char[] { ',', '!', '+', '-' }) >= 0)
{
test.RunState = RunState.NotRunnable;
test.Properties.Set(PropertyNames.SkipReason, "Category name must not contain ',', '!', '+' or '-'");
}
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,42 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// Marks a test to use a combinatorial join of any argument
/// data provided. Since this is the default, the attribute is
/// not needed.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=false)]
public class CombinatorialAttribute : PropertyAttribute
{
/// <summary>
/// Default constructor
/// </summary>
public CombinatorialAttribute() : base(PropertyNames.JoinType, "Combinatorial") { }
}
}

Просмотреть файл

@ -0,0 +1,131 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Globalization;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// CultureAttribute is used to mark a test fixture or an
/// individual method as applying to a particular Culture only.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Assembly, AllowMultiple = false, Inherited=false)]
public class CultureAttribute : IncludeExcludeAttribute, IApplyToTest
{
private CultureDetector cultureDetector = new CultureDetector();
private CultureInfo currentCulture = CultureInfo.CurrentCulture;
/// <summary>
/// Constructor with no cultures specified, for use
/// with named property syntax.
/// </summary>
public CultureAttribute() { }
/// <summary>
/// Constructor taking one or more cultures
/// </summary>
/// <param name="cultures">Comma-deliminted list of cultures</param>
public CultureAttribute(string cultures) : base(cultures) { }
#region IApplyToTest members
/// <summary>
/// Causes a test to be skipped if this CultureAttribute is not satisfied.
/// </summary>
/// <param name="test">The test to modify</param>
public void ApplyToTest(Test test)
{
if (test.RunState != RunState.NotRunnable && !IsCultureSupported())
{
test.RunState = RunState.Skipped;
test.Properties.Set(PropertyNames.SkipReason, Reason);
}
}
#endregion
/// <summary>
/// Tests to determine if the current culture is supported
/// based on the properties of this attribute.
/// </summary>
/// <returns>True, if the current culture is supported</returns>
private bool IsCultureSupported()
{
if (Include != null && !cultureDetector.IsCultureSupported(Include))
{
Reason = string.Format("Only supported under culture {0}", Include);
return false;
}
if (Exclude != null && cultureDetector.IsCultureSupported(Exclude))
{
Reason = string.Format("Not supported under culture {0}", Exclude);
return false;
}
return true;
}
/// <summary>
/// Test to determine if the a particular culture or comma-
/// delimited set of cultures is in use.
/// </summary>
/// <param name="culture">Name of the culture or comma-separated list of culture names</param>
/// <returns>True if the culture is in use on the system</returns>
public bool IsCultureSupported(string culture)
{
culture = culture.Trim();
if (culture.IndexOf(',') >= 0)
{
if (IsCultureSupported(culture.Split(new char[] { ',' })))
return true;
}
else
{
if (currentCulture.Name == culture || currentCulture.TwoLetterISOLanguageName == culture)
return true;
}
return false;
}
/// <summary>
/// Test to determine if one of a collection of culturess
/// is being used currently.
/// </summary>
/// <param name="cultures"></param>
/// <returns></returns>
public bool IsCultureSupported(string[] cultures)
{
foreach (string culture in cultures)
if (IsCultureSupported(culture))
return true;
return false;
}
}
}

Просмотреть файл

@ -0,0 +1,40 @@
// ***********************************************************************
// Copyright (c) 2010 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework
{
/// <summary>
/// The abstract base class for all data-providing attributes
/// defined by NUnit. Used to select all data sources for a
/// method, class or parameter.
/// </summary>
public abstract class DataAttribute : NUnitAttribute
{
/// <summary>
/// Default constructor
/// </summary>
public DataAttribute() { }
}
}

Просмотреть файл

@ -0,0 +1,36 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework
{
/// <summary>
/// Used to mark a field for use as a datapoint when executing a theory
/// within the same fixture that requires an argument of the field's Type.
/// </summary>
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class DatapointAttribute : NUnitAttribute
{
}
}

Просмотреть файл

@ -0,0 +1,39 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework
{
/// <summary>
/// Used to mark a field, property or method providing a set of datapoints to
/// be used in executing any theories within the same fixture that require an
/// argument of the Type provided. The data source may provide an array of
/// the required Type or an IEnumerable&lt;T&gt;.
/// Synonymous with DatapointsAttribute.
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class DatapointSourceAttribute : NUnitAttribute
{
}
}

Просмотреть файл

@ -0,0 +1,39 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework
{
/// <summary>
/// Used to mark a field, property or method providing a set of datapoints to
/// be used in executing any theories within the same fixture that require an
/// argument of the Type provided. The data source may provide an array of
/// the required Type or an IEnumerable&lt;T&gt;.
/// Synonymous with DatapointSourceAttribute.
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class DatapointsAttribute : DatapointSourceAttribute
{
}
}

Просмотреть файл

@ -0,0 +1,43 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// Attribute used to provide descriptive text about a
/// test case or fixture.
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false, Inherited=false)]
public sealed class DescriptionAttribute : PropertyAttribute
{
/// <summary>
/// Construct a description Attribute
/// </summary>
/// <param name="description">The text of the description</param>
public DescriptionAttribute(string description) : base(PropertyNames.Description, description) { }
}
}

Просмотреть файл

@ -0,0 +1,175 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Internal;
using NUnit.Framework.Internal.Commands;
using NUnit.Framework.Api;
namespace NUnit.Framework
{
/// <summary>
/// ExpectedExceptionAttribute
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=false)]
public class ExpectedExceptionAttribute : NUnitAttribute
{
private ExpectedExceptionData exceptionData = new ExpectedExceptionData();
/// <summary>
/// Constructor for a non-specific exception
/// </summary>
public ExpectedExceptionAttribute()
{
}
/// <summary>
/// Constructor for a given type of exception
/// </summary>
/// <param name="exceptionType">The type of the expected exception</param>
public ExpectedExceptionAttribute(Type exceptionType)
{
exceptionData.ExpectedExceptionType = exceptionType;
}
/// <summary>
/// Constructor for a given exception name
/// </summary>
/// <param name="exceptionName">The full name of the expected exception</param>
public ExpectedExceptionAttribute(string exceptionName)
{
exceptionData.ExpectedExceptionName = exceptionName;
}
/// <summary>
/// Gets or sets the expected exception type
/// </summary>
public Type ExpectedException
{
get { return exceptionData.ExpectedExceptionType; }
set { exceptionData.ExpectedExceptionType = value; }
}
/// <summary>
/// Gets or sets the full Type name of the expected exception
/// </summary>
public string ExpectedExceptionName
{
get { return exceptionData.ExpectedExceptionName; }
set { exceptionData.ExpectedExceptionName = value; }
}
/// <summary>
/// Gets or sets the expected message text
/// </summary>
public string ExpectedMessage
{
get { return exceptionData.ExpectedMessage; }
set { exceptionData.ExpectedMessage = value; }
}
/// <summary>
/// Gets or sets the user message displayed in case of failure
/// </summary>
public string UserMessage
{
get { return exceptionData.UserMessage; }
set { exceptionData.UserMessage = value; }
}
/// <summary>
/// Gets or sets the type of match to be performed on the expected message
/// </summary>
public MessageMatch MatchType
{
get { return exceptionData.MatchType; }
set { exceptionData.MatchType = value; }
}
/// <summary>
/// Gets the name of a method to be used as an exception handler
/// </summary>
public string Handler
{
get { return exceptionData.HandlerName; }
set { exceptionData.HandlerName = value; }
}
/// <summary>
/// Gets all data about the expected exception.
/// </summary>
public ExpectedExceptionData ExceptionData
{
get { return exceptionData; }
}
//#region IApplyToTest Members
//void IApplyToTest.ApplyToTest(ITest test)
//{
// TestMethod testMethod = test as TestMethod;
// if (testMethod != null)
// testMethod.CustomDecorators.Add(new ExpectedExceptionDecorator());
//}
//#endregion
}
/// <summary>
/// ExpectedExceptionDecorator applies to a TestCommand and returns
/// a success result only if the expected exception is thrown.
/// Otherwise, an appropriate failure result is returned.
/// </summary>
public class ExpectedExceptionDecorator : ICommandDecorator
{
private ExpectedExceptionData exceptionData;
/// <summary>
/// Construct an ExpectedExceptionDecorator using specified data.
/// </summary>
/// <param name="exceptionData">Data describing the expected exception</param>
public ExpectedExceptionDecorator(ExpectedExceptionData exceptionData)
{
this.exceptionData = exceptionData;
}
#region ICommandDecorator Members
CommandStage ICommandDecorator.Stage
{
get { return CommandStage.BelowSetUpTearDown; }
}
int ICommandDecorator.Priority
{
get { return 0; }
}
TestCommand ICommandDecorator.Decorate(TestCommand command)
{
return new ExpectedExceptionCommand(command, exceptionData);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,75 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// ExplicitAttribute marks a test or test fixture so that it will
/// only be run if explicitly executed from the gui or command line
/// or if it is included by use of a filter. The test will not be
/// run simply because an enclosing suite is run.
/// </summary>
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public class ExplicitAttribute : NUnitAttribute, IApplyToTest
{
private string reason;
/// <summary>
/// Default constructor
/// </summary>
public ExplicitAttribute()
{
this.reason = "";
}
/// <summary>
/// Constructor with a reason
/// </summary>
/// <param name="reason">The reason test is marked explicit</param>
public ExplicitAttribute(string reason)
{
this.reason = reason;
}
#region IApplyToTest members
/// <summary>
/// Modifies a test by marking it as explicit.
/// </summary>
/// <param name="test">The test to modify</param>
public void ApplyToTest(Test test)
{
if (test.RunState != RunState.NotRunnable)
{
test.RunState = RunState.Explicit;
test.Properties.Set(PropertyNames.SkipReason, reason);
}
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,75 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// Attribute used to mark a test that is to be ignored.
/// Ignored tests result in a warning message when the
/// tests are run.
/// </summary>
[AttributeUsage(AttributeTargets.Method|AttributeTargets.Class|AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public class IgnoreAttribute : NUnitAttribute, IApplyToTest
{
private string reason;
/// <summary>
/// Constructs the attribute without giving a reason
/// for ignoring the test.
/// </summary>
public IgnoreAttribute()
{
this.reason = "";
}
/// <summary>
/// Constructs the attribute giving a reason for ignoring the test
/// </summary>
/// <param name="reason">The reason for ignoring the test</param>
public IgnoreAttribute(string reason)
{
this.reason = reason;
}
#region IApplyToTest members
/// <summary>
/// Modifies a test by marking it as Ignored.
/// </summary>
/// <param name="test">The test to modify</param>
public void ApplyToTest(Test test)
{
if (test.RunState != RunState.NotRunnable)
{
test.RunState = RunState.Ignored;
test.Properties.Set(PropertyNames.SkipReason, reason);
}
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,83 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework
{
/// <summary>
/// Abstract base for Attributes that are used to include tests
/// in the test run based on environmental settings.
/// </summary>
public abstract class IncludeExcludeAttribute : NUnitAttribute
{
private string include;
private string exclude;
private string reason;
/// <summary>
/// Constructor with no included items specified, for use
/// with named property syntax.
/// </summary>
public IncludeExcludeAttribute() { }
/// <summary>
/// Constructor taking one or more included items
/// </summary>
/// <param name="include">Comma-delimited list of included items</param>
public IncludeExcludeAttribute( string include )
{
this.include = include;
}
/// <summary>
/// Name of the item that is needed in order for
/// a test to run. Multiple itemss may be given,
/// separated by a comma.
/// </summary>
public string Include
{
get { return this.include; }
set { include = value; }
}
/// <summary>
/// Name of the item to be excluded. Multiple items
/// may be given, separated by a comma.
/// </summary>
public string Exclude
{
get { return this.exclude; }
set { this.exclude = value; }
}
/// <summary>
/// The reason for including or excluding the test
/// </summary>
public string Reason
{
get { return reason; }
set { reason = value; }
}
}
}

Просмотреть файл

@ -0,0 +1,63 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Internal.Commands;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// Summary description for MaxTimeAttribute.
/// </summary>
[AttributeUsage( AttributeTargets.Method, AllowMultiple=false, Inherited=false )]
public sealed class MaxTimeAttribute : PropertyAttribute, ICommandDecorator
{
/// <summary>
/// Construct a MaxTimeAttribute, given a time in milliseconds.
/// </summary>
/// <param name="milliseconds">The maximum elapsed time in milliseconds</param>
public MaxTimeAttribute( int milliseconds )
: base( milliseconds ) { }
#region ICommandDecorator Members
CommandStage ICommandDecorator.Stage
{
get { return CommandStage.AboveSetUpTearDown; }
}
int ICommandDecorator.Priority
{
get { return 0; }
}
TestCommand ICommandDecorator.Decorate(TestCommand command)
{
return new MaxTimeCommand(command);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,38 @@
// ***********************************************************************
// Copyright (c) 2010 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework
{
/// <summary>
/// The abstract base class for all custom attributes defined by NUnit.
/// </summary>
public abstract class NUnitAttribute : Attribute
{
/// <summary>
/// Default constructor
/// </summary>
public NUnitAttribute() { }
}
}

Просмотреть файл

@ -0,0 +1,42 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// Marks a test to use a pairwise join of any argument
/// data provided. Arguments will be combined in such a
/// way that all possible pairs of arguments are used.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=false)]
public class PairwiseAttribute : PropertyAttribute
{
/// <summary>
/// Default constructor
/// </summary>
public PairwiseAttribute() : base(PropertyNames.JoinType, "Pairwise") { }
}
}

Просмотреть файл

@ -0,0 +1,68 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// PlatformAttribute is used to mark a test fixture or an
/// individual method as applying to a particular platform only.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Assembly, AllowMultiple = true, Inherited=false)]
public class PlatformAttribute : IncludeExcludeAttribute, IApplyToTest
{
private PlatformHelper platformHelper = new PlatformHelper();
/// <summary>
/// Constructor with no platforms specified, for use
/// with named property syntax.
/// </summary>
public PlatformAttribute() { }
/// <summary>
/// Constructor taking one or more platforms
/// </summary>
/// <param name="platforms">Comma-deliminted list of platforms</param>
public PlatformAttribute(string platforms) : base(platforms) { }
#region IApplyToTest members
/// <summary>
/// Causes a test to be skipped if this PlatformAttribute is not satisfied.
/// </summary>
/// <param name="test">The test to modify</param>
public void ApplyToTest(Test test)
{
if (test.RunState != RunState.NotRunnable && !platformHelper.IsPlatformSupported(this))
{
test.RunState = RunState.Skipped;
test.Properties.Add(PropertyNames.SkipReason, platformHelper.Reason);
}
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,113 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// PropertyAttribute is used to attach information to a test as a name/value pair..
/// </summary>
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true, Inherited=true)]
public class PropertyAttribute : NUnitAttribute, IApplyToTest
{
private PropertyBag properties = new PropertyBag();
/// <summary>
/// Construct a PropertyAttribute with a name and string value
/// </summary>
/// <param name="propertyName">The name of the property</param>
/// <param name="propertyValue">The property value</param>
public PropertyAttribute(string propertyName, string propertyValue)
{
this.properties.Add(propertyName, propertyValue);
}
/// <summary>
/// Construct a PropertyAttribute with a name and int value
/// </summary>
/// <param name="propertyName">The name of the property</param>
/// <param name="propertyValue">The property value</param>
public PropertyAttribute(string propertyName, int propertyValue)
{
this.properties.Add(propertyName, propertyValue);
}
/// <summary>
/// Construct a PropertyAttribute with a name and double value
/// </summary>
/// <param name="propertyName">The name of the property</param>
/// <param name="propertyValue">The property value</param>
public PropertyAttribute(string propertyName, double propertyValue)
{
this.properties.Add(propertyName, propertyValue);
}
/// <summary>
/// Constructor for derived classes that set the
/// property dictionary directly.
/// </summary>
protected PropertyAttribute() { }
/// <summary>
/// Constructor for use by derived classes that use the
/// name of the type as the property name. Derived classes
/// must ensure that the Type of the property value is
/// a standard type supported by the BCL. Any custom
/// types will cause a serialization Exception when
/// in the client.
/// </summary>
protected PropertyAttribute( object propertyValue )
{
string propertyName = this.GetType().Name;
if ( propertyName.EndsWith( "Attribute" ) )
propertyName = propertyName.Substring( 0, propertyName.Length - 9 );
this.properties.Add(propertyName, propertyValue);
}
/// <summary>
/// Gets the property dictionary for this attribute
/// </summary>
public IPropertyBag Properties
{
get { return properties; }
}
#region IApplyToTest Members
/// <summary>
/// Modifies a test by adding properties to it.
/// </summary>
/// <param name="test">The test to modify</param>
public virtual void ApplyToTest(Test test)
{
foreach (string key in Properties.Keys)
foreach(object value in Properties[key])
test.Properties.Add(key, value);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,126 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
using System.Reflection;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// RandomAttribute is used to supply a set of random values
/// to a single parameter of a parameterized test.
/// </summary>
public class RandomAttribute : ValuesAttribute, IParameterDataSource
{
enum SampleType
{
Auto,
Raw,
IntRange,
DoubleRange
}
SampleType sampleType;
private int count;
private int min, max;
private double dmin, dmax;
/// <summary>
/// Construct a set of Enums if the type is an Enum otherwise
/// Construct a set of doubles from 0.0 to 1.0,
/// specifying only the count.
/// </summary>
/// <param name="count"></param>
public RandomAttribute(int count)
{
this.count = count;
this.sampleType = SampleType.Raw;
}
/// <summary>
/// Construct a set of doubles from min to max
/// </summary>
/// <param name="min"></param>
/// <param name="max"></param>
/// <param name="count"></param>
public RandomAttribute(double min, double max, int count)
{
this.count = count;
this.dmin = min;
this.dmax = max;
this.sampleType = SampleType.DoubleRange;
}
/// <summary>
/// Construct a set of ints from min to max
/// </summary>
/// <param name="min"></param>
/// <param name="max"></param>
/// <param name="count"></param>
public RandomAttribute(int min, int max, int count)
{
this.count = count;
this.min = min;
this.max = max;
this.sampleType = SampleType.IntRange;
}
/// <summary>
/// Get the collection of values to be used as arguments
/// </summary>
public new IEnumerable GetData(ParameterInfo parameter)
{
Randomizer r = Randomizer.GetRandomizer(parameter);
IList values;
switch (sampleType)
{
default:
case SampleType.Raw:
if (parameter.ParameterType.IsEnum)
values = r.GetEnums(count,parameter.ParameterType);
else
values = r.GetDoubles(count);
break;
case SampleType.IntRange:
values = r.GetInts(min, max, count);
break;
case SampleType.DoubleRange:
values = r.GetDoubles(dmin, dmax, count);
break;
}
// Copy the random values into the data array
// and call the base class which may need to
// convert them to another type.
this.data = new object[values.Count];
for (int i = 0; i < values.Count; i++)
this.data[i] = values[i];
return base.GetData(parameter);
}
}
}

Просмотреть файл

@ -0,0 +1,104 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
namespace NUnit.Framework
{
/// <summary>
/// RangeAttribute is used to supply a range of values to an
/// individual parameter of a parameterized test.
/// </summary>
public class RangeAttribute : ValuesAttribute
{
/// <summary>
/// Construct a range of ints using default step of 1
/// </summary>
/// <param name="from"></param>
/// <param name="to"></param>
public RangeAttribute(int from, int to) : this(from, to, 1) { }
/// <summary>
/// Construct a range of ints specifying the step size
/// </summary>
/// <param name="from"></param>
/// <param name="to"></param>
/// <param name="step"></param>
public RangeAttribute(int from, int to, int step)
{
int count = (to - from) / step + 1;
this.data = new object[count];
int index = 0;
for (int val = from; index < count; val += step)
this.data[index++] = val;
}
/// <summary>
/// Construct a range of longs
/// </summary>
/// <param name="from"></param>
/// <param name="to"></param>
/// <param name="step"></param>
public RangeAttribute(long from, long to, long step)
{
long count = (to - from) / step + 1;
this.data = new object[count];
int index = 0;
for (long val = from; index < count; val += step)
this.data[index++] = val;
}
/// <summary>
/// Construct a range of doubles
/// </summary>
/// <param name="from"></param>
/// <param name="to"></param>
/// <param name="step"></param>
public RangeAttribute(double from, double to, double step)
{
double tol = step / 1000;
int count = (int)((to - from) / step + tol + 1);
this.data = new object[count];
int index = 0;
for (double val = from; index < count; val += step)
this.data[index++] = val;
}
/// <summary>
/// Construct a range of floats
/// </summary>
/// <param name="from"></param>
/// <param name="to"></param>
/// <param name="step"></param>
public RangeAttribute(float from, float to, float step)
{
float tol = step / 1000;
int count = (int)((to - from) / step + tol + 1);
this.data = new object[count];
int index = 0;
for (float val = from; index < count; val += step)
this.data[index++] = val;
}
}
}

Просмотреть файл

@ -0,0 +1,90 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
#if false
// TODO: Rework this
// RepeatAttribute should either
// 1) Apply at load time to create the exact number of tests, or
// 2) Apply at run time, generating tests or results dynamically
//
// #1 is feasible but doesn't provide much benefit
// #2 requires infrastructure for dynamic test cases first
using System;
using NUnit.Framework.Api;
using NUnit.Framework.Internal.Commands;
namespace NUnit.Framework
{
/// <summary>
/// RepeatAttribute may be applied to test case in order
/// to run it multiple times.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public class RepeatAttribute : PropertyAttribute, ICommandDecorator
{
/// <summary>
/// Construct a RepeatAttribute
/// </summary>
/// <param name="count">The number of times to run the test</param>
public RepeatAttribute(int count) : base(count) { }
//private int count;
///// <summary>
///// Construct a RepeatAttribute
///// </summary>
///// <param name="count">The number of times to run the test</param>
//public RepeatAttribute(int count)
//{
// this.count = count;
//}
///// <summary>
///// Gets the number of times to run the test.
///// </summary>
//public int Count
//{
// get { return count; }
//}
#region ICommandDecorator Members
CommandStage ICommandDecorator.Stage
{
get { return CommandStage.Repeat; }
}
int ICommandDecorator.Priority
{
get { return 0; }
}
TestCommand ICommandDecorator.Decorate(TestCommand command)
{
return new RepeatedTestCommand(command);
}
#endregion
}
}
#endif

Просмотреть файл

@ -0,0 +1,42 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// Marks a test to use a Sequential join of any argument
/// data provided. Arguments will be combined into test cases,
/// taking the next value of each argument until all are used.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=false)]
public class SequentialAttribute : PropertyAttribute
{
/// <summary>
/// Default constructor
/// </summary>
public SequentialAttribute() : base(PropertyNames.JoinType, "Sequential") { }
}
}

Просмотреть файл

@ -0,0 +1,55 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// Summary description for SetCultureAttribute.
/// </summary>
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=false, Inherited=true)]
public class SetCultureAttribute : PropertyAttribute, IApplyToContext
{
private string _culture;
/// <summary>
/// Construct given the name of a culture
/// </summary>
/// <param name="culture"></param>
public SetCultureAttribute( string culture ) : base( PropertyNames.SetCulture, culture )
{
_culture = culture;
}
#region IApplyToContext Members
void IApplyToContext.ApplyToContext(TestExecutionContext context)
{
context.CurrentCulture = new System.Globalization.CultureInfo(_culture);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,55 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// Summary description for SetUICultureAttribute.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Assembly, AllowMultiple = false, Inherited=true)]
public class SetUICultureAttribute : PropertyAttribute, IApplyToContext
{
private string _culture;
/// <summary>
/// Construct given the name of a culture
/// </summary>
/// <param name="culture"></param>
public SetUICultureAttribute(string culture) : base("SetUICulture", culture)
{
_culture = culture;
}
#region IApplyToContext Members
void IApplyToContext.ApplyToContext(TestExecutionContext context)
{
context.CurrentUICulture = new System.Globalization.CultureInfo(_culture);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,54 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework
{
using System;
/// <summary>
/// Attribute used to mark a class that contains one-time SetUp
/// and/or TearDown methods that apply to all the tests in a
/// namespace or an assembly.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=true)]
public class SetUpAttribute : NUnitAttribute
{ }
/// <summary>
/// Attribute used to mark a class that contains one-time SetUp
/// and/or TearDown methods that apply to all the tests in a
/// namespace or an assembly.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=true)]
public class PreTestAttribute : NUnitAttribute
{ }
/// <summary>
/// Attribute used to mark a class that contains one-time SetUp
/// and/or TearDown methods that apply to all the tests in a
/// namespace or an assembly.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=true)]
public class PostTestAttribute : NUnitAttribute
{ }
}

Просмотреть файл

@ -0,0 +1,36 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework
{
using System;
/// <summary>
/// Attribute used to identify a method that is called
/// immediately after each test is run. The method is
/// guaranteed to be called, even if an exception is thrown.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class TearDownAttribute : NUnitAttribute
{}
}

Просмотреть файл

@ -0,0 +1,79 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework
{
using System;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
/// <summary>
/// Adding this attribute to a method within a <seealso cref="TestFixtureAttribute"/>
/// class makes the method callable from the NUnit test runner. There is a property
/// called Description which is optional which you can provide a more detailed test
/// description. This class cannot be inherited.
/// </summary>
///
/// <example>
/// [TestFixture]
/// public class Fixture
/// {
/// [Test]
/// public void MethodToTest()
/// {}
///
/// [Test(Description = "more detailed description")]
/// publc void TestDescriptionMethod()
/// {}
/// }
/// </example>
///
[AttributeUsage(AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class TestAttribute : NUnitAttribute, IApplyToTest
{
private string description;
/// <summary>
/// Descriptive text for this test
/// </summary>
public string Description
{
get { return description; }
set { description = value; }
}
#region IApplyToTest Members
/// <summary>
/// Modifies a test by adding a description, if not already set.
/// </summary>
/// <param name="test">The test to modify</param>
public void ApplyToTest(Test test)
{
if (!test.Properties.ContainsKey(PropertyNames.Description) && description != null)
test.Properties.Set(PropertyNames.Description, description);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,446 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
using System.Reflection;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// TestCaseAttribute is used to mark parameterized test cases
/// and provide them with their arguments.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited=false)]
public class TestCaseAttribute : DataAttribute, ITestCaseData, ITestCaseSource
{
#region Instance variables
private object[] arguments;
// NOTE: Ignore unsupressed warning about exceptionData in .NET 1.1 build
private ExpectedExceptionData exceptionData;
private object expectedResult;
private bool hasExpectedResult;
private IPropertyBag properties;
private RunState runState;
#endregion
#region Constructors
/// <summary>
/// Construct a TestCaseAttribute with a list of arguments.
/// This constructor is not CLS-Compliant
/// </summary>
/// <param name="arguments"></param>
public TestCaseAttribute(params object[] arguments)
{
this.runState = RunState.Runnable;
if (arguments == null)
this.arguments = new object[] { null };
else
this.arguments = arguments;
}
/// <summary>
/// Construct a TestCaseAttribute with a single argument
/// </summary>
/// <param name="arg"></param>
public TestCaseAttribute(object arg)
{
this.runState = RunState.Runnable;
this.arguments = new object[] { arg };
}
/// <summary>
/// Construct a TestCaseAttribute with a two arguments
/// </summary>
/// <param name="arg1"></param>
/// <param name="arg2"></param>
public TestCaseAttribute(object arg1, object arg2)
{
this.runState = RunState.Runnable;
this.arguments = new object[] { arg1, arg2 };
}
/// <summary>
/// Construct a TestCaseAttribute with a three arguments
/// </summary>
/// <param name="arg1"></param>
/// <param name="arg2"></param>
/// <param name="arg3"></param>
public TestCaseAttribute(object arg1, object arg2, object arg3)
{
this.runState = RunState.Runnable;
this.arguments = new object[] { arg1, arg2, arg3 };
}
#endregion
#region Properties
/// <summary>
/// Gets the list of arguments to a test case
/// </summary>
public object[] Arguments
{
get { return arguments; }
}
/// <summary>
/// Gets or sets the expected result.
/// </summary>
/// <value>The result.</value>
public object ExpectedResult
{
get { return expectedResult; }
set
{
expectedResult = value;
hasExpectedResult = true;
}
}
/// <summary>
/// Gets the expected result (alias for use
/// by NUnit 2.6.x runners and for use
/// in legacy code. Remove the setter
/// after a time.)
/// </summary>
[Obsolete("Use ExpectedResult")]
public object Result
{
get { return ExpectedResult; }
set { ExpectedResult = value; }
}
/// <summary>
/// Returns true if the expected result has been set
/// </summary>
public bool HasExpectedResult
{
get { return hasExpectedResult; }
}
/// <summary>
/// Gets data about any expected exception for this test case.
/// </summary>
public ExpectedExceptionData ExceptionData
{
get { return exceptionData; }
}
/// <summary>
/// Gets or sets the expected exception.
/// </summary>
/// <value>The expected exception.</value>
public Type ExpectedException
{
get { return exceptionData.ExpectedExceptionType; }
set { exceptionData.ExpectedExceptionType = value; }
}
/// <summary>
/// Gets or sets the name the expected exception.
/// </summary>
/// <value>The expected name of the exception.</value>
public string ExpectedExceptionName
{
get { return exceptionData.ExpectedExceptionName; }
set { exceptionData.ExpectedExceptionName = value; }
}
/// <summary>
/// Gets or sets the expected message of the expected exception
/// </summary>
/// <value>The expected message of the exception.</value>
public string ExpectedMessage
{
get { return exceptionData.ExpectedMessage; }
set { exceptionData.ExpectedMessage = value; }
}
/// <summary>
/// Gets or sets the type of match to be performed on the expected message
/// </summary>
public MessageMatch MatchType
{
get { return exceptionData.MatchType; }
set { exceptionData.MatchType = value; }
}
/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>The description.</value>
public string Description
{
get { return this.Properties.Get(PropertyNames.Description) as string; }
set { this.Properties.Set(PropertyNames.Description, value); }
}
private string testName;
/// <summary>
/// Gets or sets the name of the test.
/// </summary>
/// <value>The name of the test.</value>
public string TestName
{
get { return testName; }
set { testName = value; }
}
/// <summary>
/// Gets or sets the ignored status of the test
/// </summary>
public bool Ignore
{
get { return this.RunState == RunState.Ignored; }
set { this.runState = value ? RunState.Ignored : RunState.Runnable; }
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="NUnit.Framework.TestCaseAttribute"/> is explicit.
/// </summary>
/// <value>
/// <c>true</c> if explicit; otherwise, <c>false</c>.
/// </value>
public bool Explicit
{
get { return this.RunState == RunState.Explicit; }
set { this.runState = value ? RunState.Explicit : RunState.Runnable; }
}
/// <summary>
/// Gets the RunState of this test case.
/// </summary>
public RunState RunState
{
get { return runState; }
}
/// <summary>
/// Gets or sets the reason for not running the test.
/// </summary>
/// <value>The reason.</value>
public string Reason
{
get { return this.Properties.Get(PropertyNames.SkipReason) as string; }
set { this.Properties.Set(PropertyNames.SkipReason, value); }
}
/// <summary>
/// Gets or sets the ignore reason. When set to a non-null
/// non-empty value, the test is marked as ignored.
/// </summary>
/// <value>The ignore reason.</value>
public string IgnoreReason
{
get { return this.Reason; }
set
{
this.runState = RunState.Ignored;
this.Reason = value;
}
}
/// <summary>
/// Gets and sets the category for this fixture.
/// May be a comma-separated list of categories.
/// </summary>
public string Category
{
get { return Properties.Get(PropertyNames.Category) as string; }
set
{
foreach (string cat in value.Split(new char[] { ',' }) )
Properties.Add(PropertyNames.Category, cat);
}
}
/// <summary>
/// Gets a list of categories for this fixture
/// </summary>
public IList Categories
{
get { return Properties[PropertyNames.Category] as IList; }
}
/// <summary>
/// NYI
/// </summary>
public IPropertyBag Properties
{
get
{
if (properties == null)
properties = new PropertyBag();
return properties;
}
}
#endregion
#region ITestCaseSource Members
/// <summary>
/// Returns an collection containing a single ITestCaseData item,
/// constructed from the arguments provided in the constructor and
/// possibly converted to match the specified method.
/// </summary>
/// <param name="method">The method for which data is being provided</param>
/// <returns></returns>
#if CLR_2_0 || CLR_4_0
public System.Collections.Generic.IEnumerable<ITestCaseData> GetTestCasesFor(System.Reflection.MethodInfo method)
#else
public System.Collections.IEnumerable GetTestCasesFor(System.Reflection.MethodInfo method)
#endif
{
ParameterSet parms;
try
{
ParameterInfo[] parameters = method.GetParameters();
int argsNeeded = parameters.Length;
int argsProvided = Arguments.Length;
parms = new ParameterSet(this);
// Special handling for params arguments
if (argsNeeded > 0 && argsProvided >= argsNeeded - 1)
{
ParameterInfo lastParameter = parameters[argsNeeded - 1];
Type lastParameterType = lastParameter.ParameterType;
Type elementType = lastParameterType.GetElementType();
if (lastParameterType.IsArray && lastParameter.IsDefined(typeof(ParamArrayAttribute), false))
{
if (argsProvided == argsNeeded)
{
Type lastArgumentType = parms.Arguments[argsProvided - 1].GetType();
if (!lastParameterType.IsAssignableFrom(lastArgumentType))
{
Array array = Array.CreateInstance(elementType, 1);
array.SetValue(parms.Arguments[argsProvided - 1], 0);
parms.Arguments[argsProvided - 1] = array;
}
}
else
{
object[] newArglist = new object[argsNeeded];
for (int i = 0; i < argsNeeded && i < argsProvided; i++)
newArglist[i] = parms.Arguments[i];
int length = argsProvided - argsNeeded + 1;
Array array = Array.CreateInstance(elementType, length);
for (int i = 0; i < length; i++)
array.SetValue(parms.Arguments[argsNeeded + i - 1], i);
newArglist[argsNeeded - 1] = array;
parms.Arguments = newArglist;
argsProvided = argsNeeded;
}
}
}
//if (method.GetParameters().Length == 1 && method.GetParameters()[0].ParameterType == typeof(object[]))
// parms.Arguments = new object[]{parms.Arguments};
// Special handling when sole argument is an object[]
if (argsNeeded == 1 && method.GetParameters()[0].ParameterType == typeof(object[]))
{
if (argsProvided > 1 ||
argsProvided == 1 && parms.Arguments[0].GetType() != typeof(object[]))
{
parms.Arguments = new object[] { parms.Arguments };
}
}
if (argsProvided == argsNeeded)
PerformSpecialConversions(parms.Arguments, parameters);
}
catch (Exception ex)
{
parms = new ParameterSet(ex);
}
return new ITestCaseData[] { parms };
}
#endregion
#region Helper Methods
/// <summary>
/// Performs several special conversions allowed by NUnit in order to
/// permit arguments with types that cannot be used in the constructor
/// of an Attribute such as TestCaseAttribute or to simplify their use.
/// </summary>
/// <param name="arglist">The arguments to be converted</param>
/// <param name="parameters">The ParameterInfo array for the method</param>
private static void PerformSpecialConversions(object[] arglist, ParameterInfo[] parameters)
{
for (int i = 0; i < arglist.Length; i++)
{
object arg = arglist[i];
Type targetType = parameters[i].ParameterType;
if (arg == null)
continue;
if (arg is SpecialValue && (SpecialValue)arg == SpecialValue.Null)
{
arglist[i] = null;
continue;
}
if (targetType.IsAssignableFrom(arg.GetType()))
continue;
if (arg is DBNull)
{
arglist[i] = null;
continue;
}
bool convert = false;
if (targetType == typeof(short) || targetType == typeof(byte) || targetType == typeof(sbyte))
convert = arg is int;
else
if (targetType == typeof(decimal))
convert = arg is double || arg is string || arg is int;
else
if (targetType == typeof(DateTime) || targetType == typeof(TimeSpan))
convert = arg is string;
if (convert)
arglist[i] = Convert.ChangeType(arg, targetType, System.Globalization.CultureInfo.InvariantCulture);
}
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,212 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
#if CLR_2_0 || CLR_4_0
using System.Collections.Generic;
#endif
using System.Reflection;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// TestCaseSourceAttribute indicates the source to be used to
/// provide test cases for a test method.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class TestCaseSourceAttribute : DataAttribute, ITestCaseSource
{
private readonly string sourceName;
private readonly Type sourceType;
/// <summary>
/// Construct with the name of the method, property or field that will prvide data
/// </summary>
/// <param name="sourceName">The name of the method, property or field that will provide data</param>
public TestCaseSourceAttribute(string sourceName)
{
this.sourceName = sourceName;
}
/// <summary>
/// Construct with a Type and name
/// </summary>
/// <param name="sourceType">The Type that will provide data</param>
/// <param name="sourceName">The name of the method, property or field that will provide data</param>
public TestCaseSourceAttribute(Type sourceType, string sourceName)
{
this.sourceType = sourceType;
this.sourceName = sourceName;
}
/// <summary>
/// Construct with a Type
/// </summary>
/// <param name="sourceType">The type that will provide data</param>
public TestCaseSourceAttribute(Type sourceType)
{
this.sourceType = sourceType;
}
/// <summary>
/// The name of a the method, property or fiend to be used as a source
/// </summary>
public string SourceName
{
get { return sourceName; }
}
/// <summary>
/// A Type to be used as a source
/// </summary>
public Type SourceType
{
get { return sourceType; }
}
private string category;
/// <summary>
/// Gets or sets the category associated with this test.
/// May be a single category or a comma-separated list.
/// </summary>
public string Category
{
get { return category; }
set { category = value; }
}
#region ITestCaseSource Members
/// <summary>
/// Returns a set of ITestCaseDataItems for use as arguments
/// to a parameterized test method.
/// </summary>
/// <param name="method">The method for which data is needed.</param>
/// <returns></returns>
#if CLR_2_0 || CLR_4_0
public IEnumerable<ITestCaseData> GetTestCasesFor(MethodInfo method)
{
List<ITestCaseData> data = new List<ITestCaseData>();
#else
public IEnumerable GetTestCasesFor(MethodInfo method)
{
ArrayList data = new ArrayList();
#endif
IEnumerable source = GetTestCaseSource(method);
if (source != null)
{
ParameterInfo[] parameters = method.GetParameters();
foreach (object item in source)
{
ParameterSet parms = new ParameterSet();
ITestCaseData testCaseData = item as ITestCaseData;
if (testCaseData != null)
parms = new ParameterSet(testCaseData);
else if (item is object[])
{
object[] array = item as object[];
parms.Arguments = array.Length == parameters.Length
? array
: new object[] { item };
}
//else if (parameters.Length == 1 && parameters[0].ParameterType.IsAssignableFrom(item.GetType()))
//{
// parms.Arguments = new object[] { item };
//}
else if (item is Array)
{
Array array = item as Array;
if (array.Rank == 1 && array.Length == parameters.Length)
{
parms.Arguments = new object[array.Length];
for (int i = 0; i < array.Length; i++)
parms.Arguments[i] = (object)array.GetValue(i);
}
else
{
parms.Arguments = new object[] { item };
}
}
else
{
parms.Arguments = new object[] { item };
}
if (this.Category != null)
foreach (string cat in this.Category.Split(new char[] { ',' }))
parms.Properties.Add(PropertyNames.Category, cat);
data.Add(parms);
}
}
return data;
}
private IEnumerable GetTestCaseSource(MethodInfo method)
{
IEnumerable source = null;
Type sourceType = this.sourceType;
if (sourceType == null)
sourceType = method.ReflectedType;
if (this.sourceName == null)
{
return Reflect.Construct(sourceType) as IEnumerable;
}
MemberInfo[] members = sourceType.GetMember(sourceName,
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
if (members.Length == 1)
{
MemberInfo member = members[0];
object sourceobject = Internal.Reflect.Construct(sourceType);
switch (member.MemberType)
{
case MemberTypes.Field:
FieldInfo field = member as FieldInfo;
source = (IEnumerable)field.GetValue(sourceobject);
break;
case MemberTypes.Property:
PropertyInfo property = member as PropertyInfo;
source = (IEnumerable)property.GetValue(sourceobject, null);
break;
case MemberTypes.Method:
MethodInfo m = member as MethodInfo;
source = (IEnumerable)m.Invoke(sourceobject, null);
break;
}
}
return source;
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,202 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
using NUnit.Framework.Api;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <example>
/// [TestFixture]
/// public class ExampleClass
/// {}
/// </example>
[AttributeUsage(AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public class TestFixtureAttribute : NUnitAttribute, IApplyToTest
{
private string description;
private object[] originalArgs;
private object[] constructorArgs;
private Type[] typeArgs;
private bool argsInitialized;
private bool isIgnored;
private string ignoreReason;
private string category;
/// <summary>
/// Default constructor
/// </summary>
public TestFixtureAttribute() : this( null ) { }
/// <summary>
/// Construct with a object[] representing a set of arguments.
/// In .NET 2.0, the arguments may later be separated into
/// type arguments and constructor arguments.
/// </summary>
/// <param name="arguments"></param>
public TestFixtureAttribute(params object[] arguments)
{
this.originalArgs = arguments == null
? new object[0]
: arguments;
this.constructorArgs = this.originalArgs;
this.typeArgs = new Type[0];
}
/// <summary>
/// Descriptive text for this fixture
/// </summary>
public string Description
{
get { return description; }
set { description = value; }
}
/// <summary>
/// The arguments originally provided to the attribute
/// </summary>
public object[] Arguments
{
get
{
if (!argsInitialized)
InitializeArgs();
return constructorArgs;
}
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="TestFixtureAttribute"/> should be ignored.
/// </summary>
/// <value><c>true</c> if ignore; otherwise, <c>false</c>.</value>
public bool Ignore
{
get { return isIgnored; }
set { isIgnored = value; }
}
/// <summary>
/// Gets or sets the ignore reason. May set Ignored as a side effect.
/// </summary>
/// <value>The ignore reason.</value>
public string IgnoreReason
{
get { return ignoreReason; }
set
{
ignoreReason = value;
isIgnored = ignoreReason != null && ignoreReason != string.Empty;
}
}
/// <summary>
/// Get or set the type arguments. If not set
/// explicitly, any leading arguments that are
/// Types are taken as type arguments.
/// </summary>
public Type[] TypeArgs
{
get
{
if (!argsInitialized)
InitializeArgs();
return typeArgs;
}
set
{
typeArgs = value;
argsInitialized = true;
}
}
/// <summary>
/// Gets and sets the category for this fixture.
/// May be a comma-separated list of categories.
/// </summary>
public string Category
{
get { return category; }
set { category = value; }
}
/// <summary>
/// Gets a list of categories for this fixture
/// </summary>
public IList Categories
{
get { return category == null ? null : category.Split(','); }
}
/// <summary>
/// Helper method to split the original argument list
/// into type arguments and constructor arguments.
/// This action has to be delayed rather than done in
/// the constructor, since TypeArgs may be set by
/// menas of a named parameter.
/// </summary>
private void InitializeArgs()
{
int typeArgCount = 0;
if (this.originalArgs != null)
{
foreach (object o in this.originalArgs)
if (o is Type) typeArgCount++;
else break;
}
this.typeArgs = new Type[typeArgCount];
for (int i = 0; i < typeArgCount; i++)
this.typeArgs[i] = (Type)this.originalArgs[i];
int constructorArgCount = originalArgs.Length - typeArgCount;
this.constructorArgs = new object[constructorArgCount];
for (int i = 0; i < constructorArgCount; i++)
this.constructorArgs[i] = this.originalArgs[typeArgCount + i];
argsInitialized = true;
}
#region IApplyToTest Members
/// <summary>
/// Modifies a test by adding a description, if not already set.
/// </summary>
/// <param name="test">The test to modify</param>
public void ApplyToTest(Test test)
{
if (!test.Properties.ContainsKey(PropertyNames.Description) && description != null)
test.Properties.Set(PropertyNames.Description, description);
if (category != null)
foreach (string cat in category.Split(new char[] { ',' }) )
test.Properties.Add(PropertyNames.Category, cat);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,36 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework
{
using System;
/// <summary>
/// Attribute used to identify a method that is
/// called before any tests in a fixture are run.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class TestFixtureSetUpAttribute : NUnitAttribute
{
}
}

Просмотреть файл

@ -0,0 +1,37 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework
{
using System;
/// <summary>
/// Attribute used to identify a method that is called after
/// all the tests in a fixture have run. The method is
/// guaranteed to be called, even if an exception is thrown.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class TestFixtureTearDownAttribute : NUnitAttribute
{
}
}

Просмотреть файл

@ -0,0 +1,63 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework
{
using System;
/// <summary>
/// Adding this attribute to a method within a <seealso cref="TestFixtureAttribute"/>
/// class makes the method callable from the NUnit test runner. There is a property
/// called Description which is optional which you can provide a more detailed test
/// description. This class cannot be inherited.
/// </summary>
///
/// <example>
/// [TestFixture]
/// public class Fixture
/// {
/// [Test]
/// public void MethodToTest()
/// {}
///
/// [Test(Description = "more detailed description")]
/// publc void TestDescriptionMethod()
/// {}
/// }
/// </example>
///
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited=true)]
public class TheoryAttribute : NUnitAttribute
{
//private string description;
///// <summary>
///// Descriptive text for this test
///// </summary>
//public string Description
//{
// get { return description; }
// set { description = value; }
//}
}
}

Просмотреть файл

@ -0,0 +1,60 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
#if (CLR_2_0 || CLR_4_0)
using System;
using NUnit.Framework.Internal;
using NUnit.Framework.Internal.Commands;
using NUnit.Framework.Api;
namespace NUnit.Framework
{
/// <summary>
/// Used on a method, marks the test with a timeout value in milliseconds.
/// The test will be run in a separate thread and is cancelled if the timeout
/// is exceeded. Used on a class or assembly, sets the default timeout
/// for all contained test methods.
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false, Inherited=false)]
public class TimeoutAttribute : PropertyAttribute, IApplyToContext
{
private int _timeout;
/// <summary>
/// Construct a TimeoutAttribute given a time in milliseconds
/// </summary>
/// <param name="timeout">The timeout value in milliseconds</param>
public TimeoutAttribute(int timeout)
: base(timeout)
{
_timeout = timeout;
}
void IApplyToContext.ApplyToContext(TestExecutionContext context)
{
context.TestCaseTimeout = _timeout;
}
}
}
#endif

Просмотреть файл

@ -0,0 +1,146 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
using System.Reflection;
using NUnit.Framework.Internal;
namespace NUnit.Framework
{
/// <summary>
/// ValueSourceAttribute indicates the source to be used to
/// provide data for one parameter of a test method.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = true, Inherited = false)]
public class ValueSourceAttribute : DataAttribute, Api.IParameterDataSource
{
private readonly string sourceName;
private readonly Type sourceType;
/// <summary>
/// Construct with the name of the factory - for use with languages
/// that don't support params arrays.
/// </summary>
/// <param name="sourceName">The name of the data source to be used</param>
public ValueSourceAttribute(string sourceName)
{
this.sourceName = sourceName;
}
/// <summary>
/// Construct with a Type and name - for use with languages
/// that don't support params arrays.
/// </summary>
/// <param name="sourceType">The Type that will provide data</param>
/// <param name="sourceName">The name of the method, property or field that will provide data</param>
public ValueSourceAttribute(Type sourceType, string sourceName)
{
this.sourceType = sourceType;
this.sourceName = sourceName;
}
/// <summary>
/// The name of a the method, property or fiend to be used as a source
/// </summary>
public string SourceName
{
get { return sourceName; }
}
/// <summary>
/// A Type to be used as a source
/// </summary>
public Type SourceType
{
get { return sourceType; }
}
#region IParameterDataSource Members
/// <summary>
/// Gets an enumeration of data items for use as arguments
/// for a test method parameter.
/// </summary>
/// <param name="parameter">The parameter for which data is needed</param>
/// <returns>
/// An enumeration containing individual data items
/// </returns>
public IEnumerable GetData(ParameterInfo parameter)
{
ObjectList data = new ObjectList();
IEnumerable source = GetDataSource(parameter);
if (source != null)
foreach (object item in source)
data.Add(item);
return source;
}
#endregion
#region Helper Methods
private IEnumerable GetDataSource(ParameterInfo parameter)
{
IEnumerable source = null;
Type sourceType = this.sourceType;
if (sourceType == null)
sourceType = parameter.Member.ReflectedType;
// TODO: Test this
if (this.sourceName == null)
{
return Reflect.Construct(sourceType) as IEnumerable;
}
MemberInfo[] members = sourceType.GetMember(sourceName,
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
if (members.Length == 1)
{
MemberInfo member = members[0];
object sourceobject = Internal.Reflect.Construct(sourceType);
switch (member.MemberType)
{
case MemberTypes.Field:
FieldInfo field = member as FieldInfo;
source = (IEnumerable)field.GetValue(sourceobject);
break;
case MemberTypes.Property:
PropertyInfo property = member as PropertyInfo;
source = (IEnumerable)property.GetValue(sourceobject, null);
break;
case MemberTypes.Method:
MethodInfo m = member as MethodInfo;
source = (IEnumerable)m.Invoke(sourceobject, null);
break;
}
}
return source;
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,134 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
using System.Reflection;
namespace NUnit.Framework
{
/// <summary>
/// ValuesAttribute is used to provide literal arguments for
/// an individual parameter of a test.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
public class ValuesAttribute : DataAttribute, Api.IParameterDataSource
{
/// <summary>
/// The collection of data to be returned. Must
/// be set by any derived attribute classes.
/// We use an object[] so that the individual
/// elements may have their type changed in GetData
/// if necessary
/// </summary>
// TODO: This causes a lot of boxing so we should eliminate it
protected object[] data;
/// <summary>
/// Construct with one argument
/// </summary>
/// <param name="arg1"></param>
public ValuesAttribute(object arg1)
{
data = new object[] { arg1 };
}
/// <summary>
/// Construct with two arguments
/// </summary>
/// <param name="arg1"></param>
/// <param name="arg2"></param>
public ValuesAttribute(object arg1, object arg2)
{
data = new object[] { arg1, arg2 };
}
/// <summary>
/// Construct with three arguments
/// </summary>
/// <param name="arg1"></param>
/// <param name="arg2"></param>
/// <param name="arg3"></param>
public ValuesAttribute(object arg1, object arg2, object arg3)
{
data = new object[] { arg1, arg2, arg3 };
}
/// <summary>
/// Construct with an array of arguments
/// </summary>
/// <param name="args"></param>
public ValuesAttribute(params object[] args)
{
data = args;
}
/// <summary>
/// Get the collection of values to be used as arguments
/// </summary>
public IEnumerable GetData(ParameterInfo parameter)
{
Type targetType = parameter.ParameterType;
for (int i = 0; i < data.Length; i++)
{
object arg = data[i];
if (arg == null)
continue;
if (arg.GetType().FullName == "NUnit.Framework.SpecialValue" &&
arg.ToString() == "Null")
{
data[i] = null;
continue;
}
if (targetType.IsAssignableFrom(arg.GetType()))
continue;
if (arg is DBNull)
{
data[i] = null;
continue;
}
bool convert = false;
if (targetType == typeof(short) || targetType == typeof(byte) || targetType == typeof(sbyte))
convert = arg is int;
else
if (targetType == typeof(decimal))
convert = arg is double || arg is string || arg is int;
else
if (targetType == typeof(DateTime) || targetType == typeof(TimeSpan))
convert = arg is string;
if (convert)
data[i] = Convert.ChangeType(arg, targetType, System.Globalization.CultureInfo.InvariantCulture);
}
return data;
}
}
}

Просмотреть файл

@ -0,0 +1,35 @@
// ***********************************************************************
// Copyright (c) 2012 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
#if NETCF_1_0 || SILVERLIGHT
namespace System
{
/// <summary>
/// Replacement for the SerializableAttribute so we compile
/// under Silverlight.
/// </summary>
public class SerializableAttribute : Attribute
{
}
}
#endif

Просмотреть файл

@ -0,0 +1,75 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// AllItemsConstraint applies another constraint to each
/// item in a collection, succeeding if they all succeed.
/// </summary>
public class AllItemsConstraint : PrefixConstraint
{
/// <summary>
/// Construct an AllItemsConstraint on top of an existing constraint
/// </summary>
/// <param name="itemConstraint"></param>
public AllItemsConstraint(Constraint itemConstraint)
: base(itemConstraint)
{
this.DisplayName = "all";
}
/// <summary>
/// Apply the item constraint to each item in the collection,
/// failing if any item fails.
/// </summary>
/// <param name="actual"></param>
/// <returns></returns>
public override bool Matches(object actual)
{
this.actual = actual;
if (!(actual is IEnumerable))
throw new ArgumentException("The actual value must be an IEnumerable", "actual");
foreach (object item in (IEnumerable)actual)
if (!baseConstraint.Matches(item))
return false;
return true;
}
/// <summary>
/// Write a description of this constraint to a MessageWriter
/// </summary>
/// <param name="writer"></param>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("all items");
baseConstraint.WriteDescriptionTo(writer);
}
}
}

Просмотреть файл

@ -0,0 +1,100 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework.Constraints
{
/// <summary>
/// AndConstraint succeeds only if both members succeed.
/// </summary>
public class AndConstraint : BinaryConstraint
{
private enum FailurePoint
{
None,
Left,
Right
};
private FailurePoint failurePoint;
/// <summary>
/// Create an AndConstraint from two other constraints
/// </summary>
/// <param name="left">The first constraint</param>
/// <param name="right">The second constraint</param>
public AndConstraint(Constraint left, Constraint right) : base(left, right) { }
/// <summary>
/// Apply both member constraints to an actual value, succeeding
/// succeeding only if both of them succeed.
/// </summary>
/// <param name="actual">The actual value</param>
/// <returns>True if the constraints both succeeded</returns>
public override bool Matches(object actual)
{
this.actual = actual;
failurePoint = left.Matches(actual)
? right.Matches(actual)
? FailurePoint.None
: FailurePoint.Right
: FailurePoint.Left;
return failurePoint == FailurePoint.None;
}
/// <summary>
/// Write a description for this contraint to a MessageWriter
/// </summary>
/// <param name="writer">The MessageWriter to receive the description</param>
public override void WriteDescriptionTo(MessageWriter writer)
{
left.WriteDescriptionTo(writer);
writer.WriteConnector("and");
right.WriteDescriptionTo(writer);
}
/// <summary>
/// Write the actual value for a failing constraint test to a
/// MessageWriter. The default implementation simply writes
/// the raw value of actual, leaving it to the writer to
/// perform any formatting.
/// </summary>
/// <param name="writer">The writer on which the actual value is displayed</param>
public override void WriteActualValueTo(MessageWriter writer)
{
switch (failurePoint)
{
case FailurePoint.Left:
left.WriteActualValueTo(writer);
break;
case FailurePoint.Right:
right.WriteActualValueTo(writer);
break;
default:
base.WriteActualValueTo(writer);
break;
}
}
}
}

Просмотреть файл

@ -0,0 +1,61 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// AssignableFromConstraint is used to test that an object
/// can be assigned from a given Type.
/// </summary>
public class AssignableFromConstraint : TypeConstraint
{
/// <summary>
/// Construct an AssignableFromConstraint for the type provided
/// </summary>
/// <param name="type"></param>
public AssignableFromConstraint(Type type) : base(type) { }
/// <summary>
/// Test whether an object can be assigned from the specified type
/// </summary>
/// <param name="actual">The object to be tested</param>
/// <returns>True if the object can be assigned a value of the expected Type, otherwise false.</returns>
public override bool Matches(object actual)
{
this.actual = actual;
return actual != null && actual.GetType().IsAssignableFrom(expectedType);
}
/// <summary>
/// Write a description of this constraint to a MessageWriter
/// </summary>
/// <param name="writer">The MessageWriter to use</param>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("assignable from");
writer.WriteExpectedValue(expectedType);
}
}
}

Просмотреть файл

@ -0,0 +1,61 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// AssignableToConstraint is used to test that an object
/// can be assigned to a given Type.
/// </summary>
public class AssignableToConstraint : TypeConstraint
{
/// <summary>
/// Construct an AssignableToConstraint for the type provided
/// </summary>
/// <param name="type"></param>
public AssignableToConstraint(Type type) : base(type) { }
/// <summary>
/// Test whether an object can be assigned to the specified type
/// </summary>
/// <param name="actual">The object to be tested</param>
/// <returns>True if the object can be assigned a value of the expected Type, otherwise false.</returns>
public override bool Matches(object actual)
{
this.actual = actual;
return actual != null && expectedType.IsAssignableFrom(actual.GetType());
}
/// <summary>
/// Write a description of this constraint to a MessageWriter
/// </summary>
/// <param name="writer">The MessageWriter to use</param>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("assignable to");
writer.WriteExpectedValue(expectedType);
}
}
}

Просмотреть файл

@ -0,0 +1,106 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// AttributeConstraint tests that a specified attribute is present
/// on a Type or other provider and that the value of the attribute
/// satisfies some other constraint.
/// </summary>
public class AttributeConstraint : PrefixConstraint
{
private readonly Type expectedType;
private Attribute attrFound;
/// <summary>
/// Constructs an AttributeConstraint for a specified attriute
/// Type and base constraint.
/// </summary>
/// <param name="type"></param>
/// <param name="baseConstraint"></param>
public AttributeConstraint(Type type, Constraint baseConstraint)
: base(baseConstraint)
{
this.expectedType = type;
if (!typeof(Attribute).IsAssignableFrom(expectedType))
throw new ArgumentException(string.Format(
"Type {0} is not an attribute", expectedType), "type");
}
/// <summary>
/// Determines whether the Type or other provider has the
/// expected attribute and if its value matches the
/// additional constraint specified.
/// </summary>
public override bool Matches(object actual)
{
this.actual = actual;
System.Reflection.ICustomAttributeProvider attrProvider =
actual as System.Reflection.ICustomAttributeProvider;
if (attrProvider == null)
throw new ArgumentException(string.Format("Actual value {0} does not implement ICustomAttributeProvider", actual), "actual");
Attribute[] attrs = (Attribute[])attrProvider.GetCustomAttributes(expectedType, true);
if (attrs.Length == 0)
throw new ArgumentException(string.Format("Attribute {0} was not found", expectedType), "actual");
attrFound = attrs[0];
return baseConstraint.Matches(attrFound);
}
/// <summary>
/// Writes a description of the attribute to the specified writer.
/// </summary>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("attribute " + expectedType.FullName);
if (baseConstraint != null)
{
if (baseConstraint is EqualConstraint)
writer.WritePredicate("equal to");
baseConstraint.WriteDescriptionTo(writer);
}
}
/// <summary>
/// Writes the actual value supplied to the specified writer.
/// </summary>
public override void WriteActualValueTo(MessageWriter writer)
{
writer.WriteActualValue(attrFound);
}
/// <summary>
/// Returns a string representation of the constraint.
/// </summary>
protected override string GetStringRepresentation()
{
return string.Format("<attribute {0} {1}>", expectedType, baseConstraint);
}
}
}

Просмотреть файл

@ -0,0 +1,76 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// AttributeExistsConstraint tests for the presence of a
/// specified attribute on a Type.
/// </summary>
public class AttributeExistsConstraint : Constraint
{
private Type expectedType;
/// <summary>
/// Constructs an AttributeExistsConstraint for a specific attribute Type
/// </summary>
/// <param name="type"></param>
public AttributeExistsConstraint(Type type)
: base(type)
{
this.expectedType = type;
if (!typeof(Attribute).IsAssignableFrom(expectedType))
throw new ArgumentException(string.Format(
"Type {0} is not an attribute", expectedType), "type");
}
/// <summary>
/// Tests whether the object provides the expected attribute.
/// </summary>
/// <param name="actual">A Type, MethodInfo, or other ICustomAttributeProvider</param>
/// <returns>True if the expected attribute is present, otherwise false</returns>
public override bool Matches(object actual)
{
this.actual = actual;
System.Reflection.ICustomAttributeProvider attrProvider =
actual as System.Reflection.ICustomAttributeProvider;
if (attrProvider == null)
throw new ArgumentException(string.Format("Actual value {0} does not implement ICustomAttributeProvider", actual), "actual");
return attrProvider.GetCustomAttributes(expectedType, true).Length > 0;
}
/// <summary>
/// Writes the description of the constraint to the specified writer
/// </summary>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("type with attribute");
writer.WriteExpectedValue(expectedType);
}
}
}

Просмотреть файл

@ -0,0 +1,73 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework.Constraints
{
/// <summary>
/// BasicConstraint is the abstract base for constraints that
/// perform a simple comparison to a constant value.
/// </summary>
public abstract class BasicConstraint : Constraint
{
private readonly object expected;
private readonly string description;
/// <summary>
/// Initializes a new instance of the <see cref="T:BasicConstraint"/> class.
/// </summary>
/// <param name="expected">The expected.</param>
/// <param name="description">The description.</param>
protected BasicConstraint(object expected, string description)
{
this.expected = expected;
this.description = description;
}
/// <summary>
/// Test whether the constraint is satisfied by a given value
/// </summary>
/// <param name="actual">The value to be tested</param>
/// <returns>True for success, false for failure</returns>
public override bool Matches(object actual)
{
this.actual = actual;
if (actual == null && expected == null)
return true;
if (actual == null || expected == null)
return false;
return expected.Equals(actual);
}
/// <summary>
/// Write the constraint description to a MessageWriter
/// </summary>
/// <param name="writer">The writer on which the description is displayed</param>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.Write(description);
}
}
}

Просмотреть файл

@ -0,0 +1,53 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
namespace NUnit.Framework.Constraints
{
/// <summary>
/// BinaryConstraint is the abstract base of all constraints
/// that combine two other constraints in some fashion.
/// </summary>
public abstract class BinaryConstraint : Constraint
{
/// <summary>
/// The first constraint being combined
/// </summary>
protected Constraint left;
/// <summary>
/// The second constraint being combined
/// </summary>
protected Constraint right;
/// <summary>
/// Construct a BinaryConstraint from two other constraints
/// </summary>
/// <param name="left">The first constraint</param>
/// <param name="right">The second constraint</param>
protected BinaryConstraint(Constraint left, Constraint right)
: base(left, right)
{
this.left = left;
this.right = right;
}
}
}

Просмотреть файл

@ -0,0 +1,100 @@
// ***********************************************************************
// Copyright (c) 2008 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
#if !NETCF && !SILVERLIGHT
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// BinarySerializableConstraint tests whether
/// an object is serializable in binary format.
/// </summary>
public class BinarySerializableConstraint : Constraint
{
readonly BinaryFormatter serializer = new BinaryFormatter();
/// <summary>
/// Test whether the constraint is satisfied by a given value
/// </summary>
/// <param name="actual">The value to be tested</param>
/// <returns>True for success, false for failure</returns>
public override bool Matches(object actual)
{
this.actual = actual;
if (actual == null)
throw new ArgumentException();
MemoryStream stream = new MemoryStream();
try
{
serializer.Serialize(stream, actual);
stream.Seek(0, SeekOrigin.Begin);
object value = serializer.Deserialize(stream);
return value != null;
}
catch (SerializationException)
{
return false;
}
}
/// <summary>
/// Write the constraint description to a MessageWriter
/// </summary>
/// <param name="writer">The writer on which the description is displayed</param>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.Write("binary serializable");
}
/// <summary>
/// Write the actual value for a failing constraint test to a
/// MessageWriter. The default implementation simply writes
/// the raw value of actual, leaving it to the writer to
/// perform any formatting.
/// </summary>
/// <param name="writer">The writer on which the actual value is displayed</param>
public override void WriteActualValueTo(MessageWriter writer)
{
writer.Write("<{0}>", actual.GetType().Name);
}
/// <summary>
/// Returns the string representation
/// </summary>
protected override string GetStringRepresentation()
{
return "<binaryserializable>";
}
}
}
#endif

Просмотреть файл

@ -0,0 +1,89 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// CollectionConstraint is the abstract base class for
/// constraints that operate on collections.
/// </summary>
public abstract class CollectionConstraint : Constraint
{
/// <summary>
/// Construct an empty CollectionConstraint
/// </summary>
protected CollectionConstraint() { }
/// <summary>
/// Construct a CollectionConstraint
/// </summary>
/// <param name="arg"></param>
protected CollectionConstraint(object arg) : base(arg) { }
/// <summary>
/// Determines whether the specified enumerable is empty.
/// </summary>
/// <param name="enumerable">The enumerable.</param>
/// <returns>
/// <c>true</c> if the specified enumerable is empty; otherwise, <c>false</c>.
/// </returns>
protected static bool IsEmpty(IEnumerable enumerable)
{
ICollection collection = enumerable as ICollection;
if (collection != null)
return collection.Count == 0;
// NOTE: Ignore unsuppressed warning about o in .NET 1.1 build
foreach (object o in enumerable)
return false;
return true;
}
/// <summary>
/// Test whether the constraint is satisfied by a given value
/// </summary>
/// <param name="actual">The value to be tested</param>
/// <returns>True for success, false for failure</returns>
public override bool Matches(object actual)
{
this.actual = actual;
IEnumerable enumerable = actual as IEnumerable;
if (enumerable == null)
throw new ArgumentException("The actual value must be an IEnumerable", "actual");
return doMatch(enumerable);
}
/// <summary>
/// Protected method to be implemented by derived classes
/// </summary>
/// <param name="collection"></param>
/// <returns></returns>
protected abstract bool doMatch(IEnumerable collection);
}
}

Просмотреть файл

@ -0,0 +1,71 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System.Collections;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// CollectionContainsConstraint is used to test whether a collection
/// contains an expected object as a member.
/// </summary>
public class CollectionContainsConstraint : CollectionItemsEqualConstraint
{
private readonly object expected;
/// <summary>
/// Construct a CollectionContainsConstraint
/// </summary>
/// <param name="expected"></param>
public CollectionContainsConstraint(object expected)
: base(expected)
{
this.expected = expected;
this.DisplayName = "contains";
}
/// <summary>
/// Test whether the expected item is contained in the collection
/// </summary>
/// <param name="actual"></param>
/// <returns></returns>
protected override bool doMatch(IEnumerable actual)
{
foreach (object obj in actual)
if (ItemsEqual(obj, expected))
return true;
return false;
}
/// <summary>
/// Write a descripton of the constraint to a MessageWriter
/// </summary>
/// <param name="writer"></param>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("collection containing");
writer.WriteExpectedValue(expected);
}
}
}

Просмотреть файл

@ -0,0 +1,73 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System.Collections;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// CollectionEquivalentCOnstraint is used to determine whether two
/// collections are equivalent.
/// </summary>
public class CollectionEquivalentConstraint : CollectionItemsEqualConstraint
{
private readonly IEnumerable expected;
/// <summary>
/// Construct a CollectionEquivalentConstraint
/// </summary>
/// <param name="expected"></param>
public CollectionEquivalentConstraint(IEnumerable expected)
: base(expected)
{
this.expected = expected;
this.DisplayName = "equivalent";
}
/// <summary>
/// Test whether two collections are equivalent
/// </summary>
/// <param name="actual"></param>
/// <returns></returns>
protected override bool doMatch(IEnumerable actual)
{
// This is just an optimization
if (expected is ICollection && actual is ICollection)
if (((ICollection)actual).Count != ((ICollection)expected).Count)
return false;
CollectionTally tally = Tally(expected);
return tally.TryRemove(actual) && tally.Count == 0;
}
/// <summary>
/// Write a description of this constraint to a MessageWriter
/// </summary>
/// <param name="writer"></param>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate("equivalent to");
writer.WriteExpectedValue(expected);
}
}
}

Просмотреть файл

@ -0,0 +1,150 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
#if CLR_2_0 || CLR_4_0
using System.Collections.Generic;
#endif
namespace NUnit.Framework.Constraints
{
/// <summary>
/// CollectionItemsEqualConstraint is the abstract base class for all
/// collection constraints that apply some notion of item equality
/// as a part of their operation.
/// </summary>
public abstract class CollectionItemsEqualConstraint : CollectionConstraint
{
private readonly NUnitEqualityComparer comparer = NUnitEqualityComparer.Default;
/// <summary>
/// Construct an empty CollectionConstraint
/// </summary>
protected CollectionItemsEqualConstraint() { }
/// <summary>
/// Construct a CollectionConstraint
/// </summary>
/// <param name="arg"></param>
protected CollectionItemsEqualConstraint(object arg) : base(arg) { }
#region Modifiers
/// <summary>
/// Flag the constraint to ignore case and return self.
/// </summary>
public CollectionItemsEqualConstraint IgnoreCase
{
get
{
comparer.IgnoreCase = true;
return this;
}
}
/// <summary>
/// Flag the constraint to use the supplied EqualityAdapter.
/// NOTE: For internal use only.
/// </summary>
/// <param name="adapter">The EqualityAdapter to use.</param>
/// <returns>Self.</returns>
internal CollectionItemsEqualConstraint Using(EqualityAdapter adapter)
{
this.comparer.ExternalComparers.Add(adapter);
return this;
}
/// <summary>
/// Flag the constraint to use the supplied IComparer object.
/// </summary>
/// <param name="comparer">The IComparer object to use.</param>
/// <returns>Self.</returns>
public CollectionItemsEqualConstraint Using(IComparer comparer)
{
return Using(EqualityAdapter.For(comparer));
}
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Flag the constraint to use the supplied IComparer object.
/// </summary>
/// <param name="comparer">The IComparer object to use.</param>
/// <returns>Self.</returns>
public CollectionItemsEqualConstraint Using<T>(IComparer<T> comparer)
{
return Using(EqualityAdapter.For(comparer));
}
/// <summary>
/// Flag the constraint to use the supplied Comparison object.
/// </summary>
/// <param name="comparer">The IComparer object to use.</param>
/// <returns>Self.</returns>
public CollectionItemsEqualConstraint Using<T>(Comparison<T> comparer)
{
return Using(EqualityAdapter.For(comparer));
}
/// <summary>
/// Flag the constraint to use the supplied IEqualityComparer object.
/// </summary>
/// <param name="comparer">The IComparer object to use.</param>
/// <returns>Self.</returns>
public CollectionItemsEqualConstraint Using(IEqualityComparer comparer)
{
return Using(EqualityAdapter.For(comparer));
}
/// <summary>
/// Flag the constraint to use the supplied IEqualityComparer object.
/// </summary>
/// <param name="comparer">The IComparer object to use.</param>
/// <returns>Self.</returns>
public CollectionItemsEqualConstraint Using<T>(IEqualityComparer<T> comparer)
{
return Using(EqualityAdapter.For(comparer));
}
#endif
#endregion
/// <summary>
/// Compares two collection members for equality
/// </summary>
protected bool ItemsEqual(object x, object y)
{
Tolerance tolerance = Tolerance.Zero;
return comparer.AreEqual(x, y, ref tolerance);
}
/// <summary>
/// Return a new CollectionTally for use in making tests
/// </summary>
/// <param name="c">The collection to be included in the tally</param>
protected CollectionTally Tally(IEnumerable c)
{
return new CollectionTally(comparer, c);
}
}
}

Просмотреть файл

@ -0,0 +1,185 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
using System.Reflection;
using System.Text;
#if CLR_2_0 || CLR_4_0
using System.Collections.Generic;
#endif
namespace NUnit.Framework.Constraints
{
/// <summary>
/// CollectionOrderedConstraint is used to test whether a collection is ordered.
/// </summary>
public class CollectionOrderedConstraint : CollectionConstraint
{
private ComparisonAdapter comparer = ComparisonAdapter.Default;
private string comparerName;
private string propertyName;
private bool descending;
/// <summary>
/// Construct a CollectionOrderedConstraint
/// </summary>
public CollectionOrderedConstraint()
{
this.DisplayName = "ordered";
}
///<summary>
/// If used performs a reverse comparison
///</summary>
public CollectionOrderedConstraint Descending
{
get
{
descending = true;
return this;
}
}
/// <summary>
/// Modifies the constraint to use an IComparer and returns self.
/// </summary>
public CollectionOrderedConstraint Using(IComparer comparer)
{
this.comparer = ComparisonAdapter.For(comparer);
this.comparerName = comparer.GetType().FullName;
return this;
}
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Modifies the constraint to use an IComparer&lt;T&gt; and returns self.
/// </summary>
public CollectionOrderedConstraint Using<T>(IComparer<T> comparer)
{
this.comparer = ComparisonAdapter.For(comparer);
this.comparerName = comparer.GetType().FullName;
return this;
}
/// <summary>
/// Modifies the constraint to use a Comparison&lt;T&gt; and returns self.
/// </summary>
public CollectionOrderedConstraint Using<T>(Comparison<T> comparer)
{
this.comparer = ComparisonAdapter.For(comparer);
this.comparerName = comparer.GetType().FullName;
return this;
}
#endif
/// <summary>
/// Modifies the constraint to test ordering by the value of
/// a specified property and returns self.
/// </summary>
public CollectionOrderedConstraint By(string propertyName)
{
this.propertyName = propertyName;
return this;
}
/// <summary>
/// Test whether the collection is ordered
/// </summary>
/// <param name="actual"></param>
/// <returns></returns>
protected override bool doMatch(IEnumerable actual)
{
object previous = null;
int index = 0;
foreach (object obj in actual)
{
object objToCompare = obj;
if (obj == null)
throw new ArgumentNullException("actual", "Null value at index " + index.ToString());
if (this.propertyName != null)
{
PropertyInfo prop = obj.GetType().GetProperty(propertyName);
objToCompare = prop.GetValue(obj, null);
if (objToCompare == null)
throw new ArgumentNullException("actual", "Null property value at index " + index.ToString());
}
if (previous != null)
{
//int comparisonResult = comparer.Compare(al[i], al[i + 1]);
int comparisonResult = comparer.Compare(previous, objToCompare);
if (descending && comparisonResult < 0)
return false;
if (!descending && comparisonResult > 0)
return false;
}
previous = objToCompare;
index++;
}
return true;
}
/// <summary>
/// Write a description of the constraint to a MessageWriter
/// </summary>
/// <param name="writer"></param>
public override void WriteDescriptionTo(MessageWriter writer)
{
if (propertyName == null)
writer.Write("collection ordered");
else
{
writer.WritePredicate("collection ordered by");
writer.WriteExpectedValue(propertyName);
}
if (descending)
writer.WriteModifier("descending");
}
/// <summary>
/// Returns the string representation of the constraint.
/// </summary>
/// <returns></returns>
protected override string GetStringRepresentation()
{
StringBuilder sb = new StringBuilder("<ordered");
if (propertyName != null)
sb.Append("by " + propertyName);
if (descending)
sb.Append(" descending");
if (comparerName != null)
sb.Append(" " + comparerName);
sb.Append(">");
return sb.ToString();
}
}
}

Просмотреть файл

@ -0,0 +1,67 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System.Collections;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// CollectionSubsetConstraint is used to determine whether
/// one collection is a subset of another
/// </summary>
public class CollectionSubsetConstraint : CollectionItemsEqualConstraint
{
private IEnumerable expected;
/// <summary>
/// Construct a CollectionSubsetConstraint
/// </summary>
/// <param name="expected">The collection that the actual value is expected to be a subset of</param>
public CollectionSubsetConstraint(IEnumerable expected) : base(expected)
{
this.expected = expected;
this.DisplayName = "subsetof";
}
/// <summary>
/// Test whether the actual collection is a subset of
/// the expected collection provided.
/// </summary>
/// <param name="actual"></param>
/// <returns></returns>
protected override bool doMatch(IEnumerable actual)
{
return Tally(expected).TryRemove( actual );
}
/// <summary>
/// Write a description of this constraint to a MessageWriter
/// </summary>
/// <param name="writer"></param>
public override void WriteDescriptionTo(MessageWriter writer)
{
writer.WritePredicate( "subset of" );
writer.WriteExpectedValue(expected);
}
}
}

Просмотреть файл

@ -0,0 +1,95 @@
// ***********************************************************************
// Copyright (c) 2010 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System.Collections;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// CollectionTally counts (tallies) the number of
/// occurences of each object in one or more enumerations.
/// </summary>
public class CollectionTally
{
// Internal list used to track occurences
private readonly ObjectList list = new ObjectList();
private readonly NUnitEqualityComparer comparer;
/// <summary>
/// Construct a CollectionTally object from a comparer and a collection
/// </summary>
public CollectionTally(NUnitEqualityComparer comparer, IEnumerable c)
{
this.comparer = comparer;
foreach (object o in c)
list.Add(o);
}
/// <summary>
/// The number of objects remaining in the tally
/// </summary>
public int Count
{
get { return list.Count; }
}
private bool ItemsEqual(object expected, object actual)
{
Tolerance tolerance = Tolerance.Zero;
return comparer.AreEqual(expected, actual, ref tolerance);
}
/// <summary>
/// Try to remove an object from the tally
/// </summary>
/// <param name="o">The object to remove</param>
/// <returns>True if successful, false if the object was not found</returns>
public bool TryRemove(object o)
{
for (int index = 0; index < list.Count; index++)
if (ItemsEqual(list[index], o))
{
list.RemoveAt(index);
return true;
}
return false;
}
/// <summary>
/// Try to remove a set of objects from the tally
/// </summary>
/// <param name="c">The objects to remove</param>
/// <returns>True if successful, false if any object was not found</returns>
public bool TryRemove(IEnumerable c)
{
foreach (object o in c)
if (!TryRemove(o))
return false;
return true;
}
}
}

Просмотреть файл

@ -0,0 +1,172 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
#if CLR_2_0 || CLR_4_0
using System.Collections.Generic;
#endif
namespace NUnit.Framework.Constraints
{
/// <summary>
/// ComparisonAdapter class centralizes all comparisons of
/// values in NUnit, adapting to the use of any provided
/// IComparer, IComparer&lt;T&gt; or Comparison&lt;T&gt;
/// </summary>
public abstract class ComparisonAdapter
{
/// <summary>
/// Gets the default ComparisonAdapter, which wraps an
/// NUnitComparer object.
/// </summary>
public static ComparisonAdapter Default
{
get { return new DefaultComparisonAdapter(); }
}
/// <summary>
/// Returns a ComparisonAdapter that wraps an IComparer
/// </summary>
public static ComparisonAdapter For(IComparer comparer)
{
return new ComparerAdapter(comparer);
}
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Returns a ComparisonAdapter that wraps an IComparer&lt;T&gt;
/// </summary>
public static ComparisonAdapter For<T>(IComparer<T> comparer)
{
return new ComparerAdapter<T>(comparer);
}
/// <summary>
/// Returns a ComparisonAdapter that wraps a Comparison&lt;T&gt;
/// </summary>
public static ComparisonAdapter For<T>(Comparison<T> comparer)
{
return new ComparisonAdapterForComparison<T>(comparer);
}
#endif
/// <summary>
/// Compares two objects
/// </summary>
public abstract int Compare(object expected, object actual);
class DefaultComparisonAdapter : ComparerAdapter
{
/// <summary>
/// Construct a default ComparisonAdapter
/// </summary>
public DefaultComparisonAdapter() : base( NUnitComparer.Default ) { }
}
class ComparerAdapter : ComparisonAdapter
{
private readonly IComparer comparer;
/// <summary>
/// Construct a ComparisonAdapter for an IComparer
/// </summary>
public ComparerAdapter(IComparer comparer)
{
this.comparer = comparer;
}
/// <summary>
/// Compares two objects
/// </summary>
/// <param name="expected"></param>
/// <param name="actual"></param>
/// <returns></returns>
public override int Compare(object expected, object actual)
{
return comparer.Compare(expected, actual);
}
}
#if CLR_2_0 || CLR_4_0
/// <summary>
/// ComparisonAdapter&lt;T&gt; extends ComparisonAdapter and
/// allows use of an IComparer&lt;T&gt; or Comparison&lt;T&gt;
/// to actually perform the comparison.
/// </summary>
class ComparerAdapter<T> : ComparisonAdapter
{
private readonly IComparer<T> comparer;
/// <summary>
/// Construct a ComparisonAdapter for an IComparer&lt;T&gt;
/// </summary>
public ComparerAdapter(IComparer<T> comparer)
{
this.comparer = comparer;
}
/// <summary>
/// Compare a Type T to an object
/// </summary>
public override int Compare(object expected, object actual)
{
if (!typeof(T).IsAssignableFrom(expected.GetType()))
throw new ArgumentException("Cannot compare " + expected.ToString());
if (!typeof(T).IsAssignableFrom(actual.GetType()))
throw new ArgumentException("Cannot compare to " + actual.ToString());
return comparer.Compare((T)expected, (T)actual);
}
}
class ComparisonAdapterForComparison<T> : ComparisonAdapter
{
private readonly Comparison<T> comparison;
/// <summary>
/// Construct a ComparisonAdapter for a Comparison&lt;T&gt;
/// </summary>
public ComparisonAdapterForComparison(Comparison<T> comparer)
{
this.comparison = comparer;
}
/// <summary>
/// Compare a Type T to an object
/// </summary>
public override int Compare(object expected, object actual)
{
if (!typeof(T).IsAssignableFrom(expected.GetType()))
throw new ArgumentException("Cannot compare " + expected.ToString());
if (!typeof(T).IsAssignableFrom(actual.GetType()))
throw new ArgumentException("Cannot compare to " + actual.ToString());
return comparison.Invoke((T)expected, (T)actual);
}
}
#endif
}
}

Просмотреть файл

@ -0,0 +1,83 @@
// ***********************************************************************
// Copyright (c) 2011 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
#if CLR_2_0 || CLR_4_0
using System.Collections.Generic;
#endif
namespace NUnit.Framework.Constraints
{
/// <summary>
/// Abstract base class for constraints that compare values to
/// determine if one is greater than, equal to or less than
/// the other. This class supplies the Using modifiers.
/// </summary>
public abstract class ComparisonConstraint : Constraint
{
/// <summary>
/// ComparisonAdapter to be used in making the comparison
/// </summary>
protected ComparisonAdapter comparer = ComparisonAdapter.Default;
/// <summary>
/// Initializes a new instance of the <see cref="T:ComparisonConstraint"/> class.
/// </summary>
public ComparisonConstraint(object arg) : base(arg) { }
/// <summary>
/// Initializes a new instance of the <see cref="T:ComparisonConstraint"/> class.
/// </summary>
public ComparisonConstraint(object arg1, object arg2) : base(arg1, arg2) { }
/// <summary>
/// Modifies the constraint to use an IComparer and returns self
/// </summary>
public ComparisonConstraint Using(IComparer comparer)
{
this.comparer = ComparisonAdapter.For(comparer);
return this;
}
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Modifies the constraint to use an IComparer&lt;T&gt; and returns self
/// </summary>
public ComparisonConstraint Using<T>(IComparer<T> comparer)
{
this.comparer = ComparisonAdapter.For(comparer);
return this;
}
/// <summary>
/// Modifies the constraint to use a Comparison&lt;T&gt; and returns self
/// </summary>
public ComparisonConstraint Using<T>(Comparison<T> comparer)
{
this.comparer = ComparisonAdapter.For(comparer);
return this;
}
#endif
}
}

Просмотреть файл

@ -0,0 +1,416 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System.Collections;
using NUnit.Framework.Internal;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// Delegate used to delay evaluation of the actual value
/// to be used in evaluating a constraint
/// </summary>
#if CLR_2_0 || CLR_4_0
public delegate T ActualValueDelegate<T>();
#else
public delegate object ActualValueDelegate();
#endif
/// <summary>
/// The Constraint class is the base of all built-in constraints
/// within NUnit. It provides the operator overloads used to combine
/// constraints.
/// </summary>
public abstract class Constraint : IResolveConstraint
{
#region UnsetObject Class
/// <summary>
/// Class used to detect any derived constraints
/// that fail to set the actual value in their
/// Matches override.
/// </summary>
private class UnsetObject
{
public override string ToString()
{
return "UNSET";
}
}
#endregion
#region Static and Instance Fields
/// <summary>
/// Static UnsetObject used to detect derived constraints
/// failing to set the actual value.
/// </summary>
protected static object UNSET = new UnsetObject();
/// <summary>
/// The actual value being tested against a constraint
/// </summary>
protected object actual = UNSET;
/// <summary>
/// The display name of this Constraint for use by ToString()
/// </summary>
private string displayName;
/// <summary>
/// Argument fields used by ToString();
/// </summary>
private readonly int argcnt;
private readonly object arg1;
private readonly object arg2;
/// <summary>
/// The builder holding this constraint
/// </summary>
private ConstraintBuilder builder;
#endregion
#region Constructors
/// <summary>
/// Construct a constraint with no arguments
/// </summary>
protected Constraint()
{
argcnt = 0;
}
/// <summary>
/// Construct a constraint with one argument
/// </summary>
protected Constraint(object arg)
{
argcnt = 1;
this.arg1 = arg;
}
/// <summary>
/// Construct a constraint with two arguments
/// </summary>
protected Constraint(object arg1, object arg2)
{
argcnt = 2;
this.arg1 = arg1;
this.arg2 = arg2;
}
#endregion
#region Set Containing ConstraintBuilder
/// <summary>
/// Sets the ConstraintBuilder holding this constraint
/// </summary>
internal void SetBuilder(ConstraintBuilder builder)
{
this.builder = builder;
}
#endregion
#region Properties
/// <summary>
/// The display name of this Constraint for use by ToString().
/// The default value is the name of the constraint with
/// trailing "Constraint" removed. Derived classes may set
/// this to another name in their constructors.
/// </summary>
protected string DisplayName
{
get
{
if (displayName == null)
{
displayName = this.GetType().Name.ToLower();
if (displayName.EndsWith("`1") || displayName.EndsWith("`2"))
displayName = displayName.Substring(0, displayName.Length - 2);
if (displayName.EndsWith("constraint"))
displayName = displayName.Substring(0, displayName.Length - 10);
}
return displayName;
}
set { displayName = value; }
}
#endregion
#region Abstract and Virtual Methods
/// <summary>
/// Write the failure message to the MessageWriter provided
/// as an argument. The default implementation simply passes
/// the constraint and the actual value to the writer, which
/// then displays the constraint description and the value.
///
/// Constraints that need to provide additional details,
/// such as where the error occured can override this.
/// </summary>
/// <param name="writer">The MessageWriter on which to display the message</param>
public virtual void WriteMessageTo(MessageWriter writer)
{
writer.DisplayDifferences(this);
}
/// <summary>
/// Test whether the constraint is satisfied by a given value
/// </summary>
/// <param name="actual">The value to be tested</param>
/// <returns>True for success, false for failure</returns>
public abstract bool Matches(object actual);
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Test whether the constraint is satisfied by an
/// ActualValueDelegate that returns the value to be tested.
/// The default implementation simply evaluates the delegate
/// but derived classes may override it to provide for delayed
/// processing.
/// </summary>
/// <param name="del">An <see cref="ActualValueDelegate{T}" /></param>
/// <returns>True for success, false for failure</returns>
public virtual bool Matches<T>(ActualValueDelegate<T> del)
{
#if NET_4_5
if (AsyncInvocationRegion.IsAsyncOperation(del))
using (var region = AsyncInvocationRegion.Create(del))
return Matches(region.WaitForPendingOperationsToComplete(del()));
#endif
return Matches(del());
}
#else
/// <summary>
/// Test whether the constraint is satisfied by an
/// ActualValueDelegate that returns the value to be tested.
/// The default implementation simply evaluates the delegate
/// but derived classes may override it to provide for delayed
/// processing.
/// </summary>
/// <param name="del">An <see cref="ActualValueDelegate" /></param>
/// <returns>True for success, false for failure</returns>
public virtual bool Matches(ActualValueDelegate del)
{
return Matches(del());
}
#endif
/// <summary>
/// Test whether the constraint is satisfied by a given reference.
/// The default implementation simply dereferences the value but
/// derived classes may override it to provide for delayed processing.
/// </summary>
/// <param name="actual">A reference to the value to be tested</param>
/// <returns>True for success, false for failure</returns>
#if CLR_2_0 || CLR_4_0
public virtual bool Matches<T>(ref T actual)
#else
public virtual bool Matches(ref bool actual)
#endif
{
return Matches(actual);
}
/// <summary>
/// Write the constraint description to a MessageWriter
/// </summary>
/// <param name="writer">The writer on which the description is displayed</param>
public abstract void WriteDescriptionTo(MessageWriter writer);
/// <summary>
/// Write the actual value for a failing constraint test to a
/// MessageWriter. The default implementation simply writes
/// the raw value of actual, leaving it to the writer to
/// perform any formatting.
/// </summary>
/// <param name="writer">The writer on which the actual value is displayed</param>
public virtual void WriteActualValueTo(MessageWriter writer)
{
writer.WriteActualValue(actual);
}
#endregion
#region ToString Override
/// <summary>
/// Default override of ToString returns the constraint DisplayName
/// followed by any arguments within angle brackets.
/// </summary>
/// <returns></returns>
public override string ToString()
{
string rep = GetStringRepresentation();
return this.builder == null ? rep : string.Format("<unresolved {0}>", rep);
}
/// <summary>
/// Returns the string representation of this constraint
/// </summary>
protected virtual string GetStringRepresentation()
{
switch (argcnt)
{
default:
case 0:
return string.Format("<{0}>", DisplayName);
case 1:
return string.Format("<{0} {1}>", DisplayName, _displayable(arg1));
case 2:
return string.Format("<{0} {1} {2}>", DisplayName, _displayable(arg1), _displayable(arg2));
}
}
private static string _displayable(object o)
{
if (o == null) return "null";
string fmt = o is string ? "\"{0}\"" : "{0}";
return string.Format(System.Globalization.CultureInfo.InvariantCulture, fmt, o);
}
#endregion
#region Operator Overloads
/// <summary>
/// This operator creates a constraint that is satisfied only if both
/// argument constraints are satisfied.
/// </summary>
public static Constraint operator &(Constraint left, Constraint right)
{
IResolveConstraint l = (IResolveConstraint)left;
IResolveConstraint r = (IResolveConstraint)right;
return new AndConstraint(l.Resolve(), r.Resolve());
}
/// <summary>
/// This operator creates a constraint that is satisfied if either
/// of the argument constraints is satisfied.
/// </summary>
public static Constraint operator |(Constraint left, Constraint right)
{
IResolveConstraint l = (IResolveConstraint)left;
IResolveConstraint r = (IResolveConstraint)right;
return new OrConstraint(l.Resolve(), r.Resolve());
}
/// <summary>
/// This operator creates a constraint that is satisfied if the
/// argument constraint is not satisfied.
/// </summary>
public static Constraint operator !(Constraint constraint)
{
IResolveConstraint r = constraint as IResolveConstraint;
return new NotConstraint(r == null ? new NullConstraint() : r.Resolve());
}
#endregion
#region Binary Operators
/// <summary>
/// Returns a ConstraintExpression by appending And
/// to the current constraint.
/// </summary>
public ConstraintExpression And
{
get
{
ConstraintBuilder builder = this.builder;
if (builder == null)
{
builder = new ConstraintBuilder();
builder.Append(this);
}
builder.Append(new AndOperator());
return new ConstraintExpression(builder);
}
}
/// <summary>
/// Returns a ConstraintExpression by appending And
/// to the current constraint.
/// </summary>
public ConstraintExpression With
{
get { return this.And; }
}
/// <summary>
/// Returns a ConstraintExpression by appending Or
/// to the current constraint.
/// </summary>
public ConstraintExpression Or
{
get
{
ConstraintBuilder builder = this.builder;
if (builder == null)
{
builder = new ConstraintBuilder();
builder.Append(this);
}
builder.Append(new OrOperator());
return new ConstraintExpression(builder);
}
}
#endregion
#region After Modifier
#if !SILVERLIGHT
/// <summary>
/// Returns a DelayedConstraint with the specified delay time.
/// </summary>
/// <param name="delayInMilliseconds">The delay in milliseconds.</param>
/// <returns></returns>
public DelayedConstraint After(int delayInMilliseconds)
{
return new DelayedConstraint(
builder == null ? this : builder.Resolve(),
delayInMilliseconds);
}
/// <summary>
/// Returns a DelayedConstraint with the specified delay time
/// and polling interval.
/// </summary>
/// <param name="delayInMilliseconds">The delay in milliseconds.</param>
/// <param name="pollingInterval">The interval at which to test the constraint.</param>
/// <returns></returns>
public DelayedConstraint After(int delayInMilliseconds, int pollingInterval)
{
return new DelayedConstraint(
builder == null ? this : builder.Resolve(),
delayInMilliseconds,
pollingInterval);
}
#endif
#endregion
#region IResolveConstraint Members
Constraint IResolveConstraint.Resolve()
{
return builder == null ? this : builder.Resolve();
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,286 @@
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
#if CLR_2_0 || CLR_4_0
using System.Collections.Generic;
#endif
namespace NUnit.Framework.Constraints
{
/// <summary>
/// ConstraintBuilder maintains the stacks that are used in
/// processing a ConstraintExpression. An OperatorStack
/// is used to hold operators that are waiting for their
/// operands to be reognized. a ConstraintStack holds
/// input constraints as well as the results of each
/// operator applied.
/// </summary>
public class ConstraintBuilder
{
#region Nested Operator Stack Class
/// <summary>
/// OperatorStack is a type-safe stack for holding ConstraintOperators
/// </summary>
public class OperatorStack
{
#if CLR_2_0 || CLR_4_0
private Stack<ConstraintOperator> stack = new Stack<ConstraintOperator>();
#else
private Stack stack = new Stack();
#endif
/// <summary>
/// Initializes a new instance of the <see cref="T:OperatorStack"/> class.
/// </summary>
/// <param name="builder">The builder.</param>
public OperatorStack(ConstraintBuilder builder)
{
}
/// <summary>
/// Gets a value indicating whether this <see cref="T:OpStack"/> is empty.
/// </summary>
/// <value><c>true</c> if empty; otherwise, <c>false</c>.</value>
public bool Empty
{
get { return stack.Count == 0; }
}
/// <summary>
/// Gets the topmost operator without modifying the stack.
/// </summary>
/// <value>The top.</value>
public ConstraintOperator Top
{
get { return (ConstraintOperator)stack.Peek(); }
}
/// <summary>
/// Pushes the specified operator onto the stack.
/// </summary>
/// <param name="op">The op.</param>
public void Push(ConstraintOperator op)
{
stack.Push(op);
}
/// <summary>
/// Pops the topmost operator from the stack.
/// </summary>
/// <returns></returns>
public ConstraintOperator Pop()
{
return (ConstraintOperator)stack.Pop();
}
}
#endregion
#region Nested Constraint Stack Class
/// <summary>
/// ConstraintStack is a type-safe stack for holding Constraints
/// </summary>
public class ConstraintStack
{
#if CLR_2_0 || CLR_4_0
private Stack<Constraint> stack = new Stack<Constraint>();
#else
private Stack stack = new Stack();
#endif
private ConstraintBuilder builder;
/// <summary>
/// Initializes a new instance of the <see cref="T:ConstraintStack"/> class.
/// </summary>
/// <param name="builder">The builder.</param>
public ConstraintStack(ConstraintBuilder builder)
{
this.builder = builder;
}
/// <summary>
/// Gets a value indicating whether this <see cref="T:ConstraintStack"/> is empty.
/// </summary>
/// <value><c>true</c> if empty; otherwise, <c>false</c>.</value>
public bool Empty
{
get { return stack.Count == 0; }
}
/// <summary>
/// Gets the topmost constraint without modifying the stack.
/// </summary>
/// <value>The topmost constraint</value>
public Constraint Top
{
get { return (Constraint)stack.Peek(); }
}
/// <summary>
/// Pushes the specified constraint. As a side effect,
/// the constraint's builder field is set to the
/// ConstraintBuilder owning this stack.
/// </summary>
/// <param name="constraint">The constraint.</param>
public void Push(Constraint constraint)
{
stack.Push(constraint);
constraint.SetBuilder( this.builder );
}
/// <summary>
/// Pops this topmost constrait from the stack.
/// As a side effect, the constraint's builder
/// field is set to null.
/// </summary>
/// <returns></returns>
public Constraint Pop()
{
Constraint constraint = (Constraint)stack.Pop();
constraint.SetBuilder( null );
return constraint;
}
}
#endregion
#region Instance Fields
private readonly OperatorStack ops;
private readonly ConstraintStack constraints;
private object lastPushed;
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="T:ConstraintBuilder"/> class.
/// </summary>
public ConstraintBuilder()
{
this.ops = new OperatorStack(this);
this.constraints = new ConstraintStack(this);
}
#endregion
#region Properties
/// <summary>
/// Gets a value indicating whether this instance is resolvable.
/// </summary>
/// <value>
/// <c>true</c> if this instance is resolvable; otherwise, <c>false</c>.
/// </value>
public bool IsResolvable
{
get { return lastPushed is Constraint || lastPushed is SelfResolvingOperator; }
}
#endregion
#region Public Methods
/// <summary>
/// Appends the specified operator to the expression by first
/// reducing the operator stack and then pushing the new
/// operator on the stack.
/// </summary>
/// <param name="op">The operator to push.</param>
public void Append(ConstraintOperator op)
{
op.LeftContext = lastPushed;
if (lastPushed is ConstraintOperator)
SetTopOperatorRightContext(op);
// Reduce any lower precedence operators
ReduceOperatorStack(op.LeftPrecedence);
ops.Push(op);
lastPushed = op;
}
/// <summary>
/// Appends the specified constraint to the expresson by pushing
/// it on the constraint stack.
/// </summary>
/// <param name="constraint">The constraint to push.</param>
public void Append(Constraint constraint)
{
if (lastPushed is ConstraintOperator)
SetTopOperatorRightContext(constraint);
constraints.Push(constraint);
lastPushed = constraint;
constraint.SetBuilder( this );
}
/// <summary>
/// Sets the top operator right context.
/// </summary>
/// <param name="rightContext">The right context.</param>
private void SetTopOperatorRightContext(object rightContext)
{
// Some operators change their precedence based on
// the right context - save current precedence.
int oldPrecedence = ops.Top.LeftPrecedence;
ops.Top.RightContext = rightContext;
// If the precedence increased, we may be able to
// reduce the region of the stack below the operator
if (ops.Top.LeftPrecedence > oldPrecedence)
{
ConstraintOperator changedOp = ops.Pop();
ReduceOperatorStack(changedOp.LeftPrecedence);
ops.Push(changedOp);
}
}
/// <summary>
/// Reduces the operator stack until the topmost item
/// precedence is greater than or equal to the target precedence.
/// </summary>
/// <param name="targetPrecedence">The target precedence.</param>
private void ReduceOperatorStack(int targetPrecedence)
{
while (!ops.Empty && ops.Top.RightPrecedence < targetPrecedence)
ops.Pop().Reduce(constraints);
}
/// <summary>
/// Resolves this instance, returning a Constraint. If the builder
/// is not currently in a resolvable state, an exception is thrown.
/// </summary>
/// <returns>The resolved constraint</returns>
public Constraint Resolve()
{
if (!IsResolvable)
throw new InvalidOperationException("A partial expression may not be resolved");
while (!ops.Empty)
{
ConstraintOperator op = ops.Pop();
op.Reduce(constraints);
}
return constraints.Pop();
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,803 @@
// ***********************************************************************
// Copyright (c) 2009 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// ConstraintExpression represents a compound constraint in the
/// process of being constructed from a series of syntactic elements.
///
/// Individual elements are appended to the expression as they are
/// reognized. Once an actual Constraint is appended, the expression
/// returns a resolvable Constraint.
/// </summary>
public class ConstraintExpression : ConstraintExpressionBase
{
/// <summary>
/// Initializes a new instance of the <see cref="T:ConstraintExpression"/> class.
/// </summary>
public ConstraintExpression() { }
/// <summary>
/// Initializes a new instance of the <see cref="T:ConstraintExpression"/>
/// class passing in a ConstraintBuilder, which may be pre-populated.
/// </summary>
/// <param name="builder">The builder.</param>
public ConstraintExpression(ConstraintBuilder builder)
: base( builder ) { }
#region Not
/// <summary>
/// Returns a ConstraintExpression that negates any
/// following constraint.
/// </summary>
public ConstraintExpression Not
{
get { return this.Append(new NotOperator()); }
}
/// <summary>
/// Returns a ConstraintExpression that negates any
/// following constraint.
/// </summary>
public ConstraintExpression No
{
get { return this.Append(new NotOperator()); }
}
#endregion
#region All
/// <summary>
/// Returns a ConstraintExpression, which will apply
/// the following constraint to all members of a collection,
/// succeeding if all of them succeed.
/// </summary>
public ConstraintExpression All
{
get { return this.Append(new AllOperator()); }
}
#endregion
#region Some
/// <summary>
/// Returns a ConstraintExpression, which will apply
/// the following constraint to all members of a collection,
/// succeeding if at least one of them succeeds.
/// </summary>
public ConstraintExpression Some
{
get { return this.Append(new SomeOperator()); }
}
#endregion
#region None
/// <summary>
/// Returns a ConstraintExpression, which will apply
/// the following constraint to all members of a collection,
/// succeeding if all of them fail.
/// </summary>
public ConstraintExpression None
{
get { return this.Append(new NoneOperator()); }
}
#endregion
#region Exactly(n)
/// <summary>
/// Returns a ConstraintExpression, which will apply
/// the following constraint to all members of a collection,
/// succeeding only if a specified number of them succeed.
/// </summary>
public ConstraintExpression Exactly(int expectedCount)
{
return this.Append(new ExactCountOperator(expectedCount));
}
#endregion
#region Property
/// <summary>
/// Returns a new PropertyConstraintExpression, which will either
/// test for the existence of the named property on the object
/// being tested or apply any following constraint to that property.
/// </summary>
public ResolvableConstraintExpression Property(string name)
{
return this.Append(new PropOperator(name));
}
#endregion
#region Length
/// <summary>
/// Returns a new ConstraintExpression, which will apply the following
/// constraint to the Length property of the object being tested.
/// </summary>
public ResolvableConstraintExpression Length
{
get { return Property("Length"); }
}
#endregion
#region Count
/// <summary>
/// Returns a new ConstraintExpression, which will apply the following
/// constraint to the Count property of the object being tested.
/// </summary>
public ResolvableConstraintExpression Count
{
get { return Property("Count"); }
}
#endregion
#region Message
/// <summary>
/// Returns a new ConstraintExpression, which will apply the following
/// constraint to the Message property of the object being tested.
/// </summary>
public ResolvableConstraintExpression Message
{
get { return Property("Message"); }
}
#endregion
#region InnerException
/// <summary>
/// Returns a new ConstraintExpression, which will apply the following
/// constraint to the InnerException property of the object being tested.
/// </summary>
public ResolvableConstraintExpression InnerException
{
get { return Property("InnerException"); }
}
#endregion
#region Attribute
/// <summary>
/// Returns a new AttributeConstraint checking for the
/// presence of a particular attribute on an object.
/// </summary>
public ResolvableConstraintExpression Attribute(Type expectedType)
{
return this.Append(new AttributeOperator(expectedType));
}
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Returns a new AttributeConstraint checking for the
/// presence of a particular attribute on an object.
/// </summary>
public ResolvableConstraintExpression Attribute<T>()
{
return Attribute(typeof(T));
}
#endif
#endregion
#region With
/// <summary>
/// With is currently a NOP - reserved for future use.
/// </summary>
public ConstraintExpression With
{
get { return this.Append(new WithOperator()); }
}
#endregion
#region Matches
/// <summary>
/// Returns the constraint provided as an argument - used to allow custom
/// custom constraints to easily participate in the syntax.
/// </summary>
public Constraint Matches(Constraint constraint)
{
return this.Append(constraint);
}
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Returns the constraint provided as an argument - used to allow custom
/// custom constraints to easily participate in the syntax.
/// </summary>
public Constraint Matches<T>(Predicate<T> predicate)
{
return this.Append(new PredicateConstraint<T>(predicate));
}
#endif
#endregion
#region Null
/// <summary>
/// Returns a constraint that tests for null
/// </summary>
public NullConstraint Null
{
get { return (NullConstraint)this.Append(new NullConstraint()); }
}
#endregion
#region True
/// <summary>
/// Returns a constraint that tests for True
/// </summary>
public TrueConstraint True
{
get { return (TrueConstraint)this.Append(new TrueConstraint()); }
}
#endregion
#region False
/// <summary>
/// Returns a constraint that tests for False
/// </summary>
public FalseConstraint False
{
get { return (FalseConstraint)this.Append(new FalseConstraint()); }
}
#endregion
#region Positive
/// <summary>
/// Returns a constraint that tests for a positive value
/// </summary>
public GreaterThanConstraint Positive
{
get { return (GreaterThanConstraint)this.Append(new GreaterThanConstraint(0)); }
}
#endregion
#region Negative
/// <summary>
/// Returns a constraint that tests for a negative value
/// </summary>
public LessThanConstraint Negative
{
get { return (LessThanConstraint)this.Append(new LessThanConstraint(0)); }
}
#endregion
#region NaN
/// <summary>
/// Returns a constraint that tests for NaN
/// </summary>
public NaNConstraint NaN
{
get { return (NaNConstraint)this.Append(new NaNConstraint()); }
}
#endregion
#region Empty
/// <summary>
/// Returns a constraint that tests for empty
/// </summary>
public EmptyConstraint Empty
{
get { return (EmptyConstraint)this.Append(new EmptyConstraint()); }
}
#endregion
#region Unique
/// <summary>
/// Returns a constraint that tests whether a collection
/// contains all unique items.
/// </summary>
public UniqueItemsConstraint Unique
{
get { return (UniqueItemsConstraint)this.Append(new UniqueItemsConstraint()); }
}
#endregion
#region BinarySerializable
#if !NETCF && !SILVERLIGHT
/// <summary>
/// Returns a constraint that tests whether an object graph is serializable in binary format.
/// </summary>
public BinarySerializableConstraint BinarySerializable
{
get { return (BinarySerializableConstraint)this.Append(new BinarySerializableConstraint()); }
}
#endif
#endregion
#region XmlSerializable
#if !SILVERLIGHT
/// <summary>
/// Returns a constraint that tests whether an object graph is serializable in xml format.
/// </summary>
public XmlSerializableConstraint XmlSerializable
{
get { return (XmlSerializableConstraint)this.Append(new XmlSerializableConstraint()); }
}
#endif
#endregion
#region EqualTo
/// <summary>
/// Returns a constraint that tests two items for equality
/// </summary>
public EqualConstraint EqualTo(object expected)
{
return (EqualConstraint)this.Append(new EqualConstraint(expected));
}
#endregion
#region SameAs
/// <summary>
/// Returns a constraint that tests that two references are the same object
/// </summary>
public SameAsConstraint SameAs(object expected)
{
return (SameAsConstraint)this.Append(new SameAsConstraint(expected));
}
#endregion
#region GreaterThan
/// <summary>
/// Returns a constraint that tests whether the
/// actual value is greater than the suppled argument
/// </summary>
public GreaterThanConstraint GreaterThan(object expected)
{
return (GreaterThanConstraint)this.Append(new GreaterThanConstraint(expected));
}
#endregion
#region GreaterThanOrEqualTo
/// <summary>
/// Returns a constraint that tests whether the
/// actual value is greater than or equal to the suppled argument
/// </summary>
public GreaterThanOrEqualConstraint GreaterThanOrEqualTo(object expected)
{
return (GreaterThanOrEqualConstraint)this.Append(new GreaterThanOrEqualConstraint(expected));
}
/// <summary>
/// Returns a constraint that tests whether the
/// actual value is greater than or equal to the suppled argument
/// </summary>
public GreaterThanOrEqualConstraint AtLeast(object expected)
{
return (GreaterThanOrEqualConstraint)this.Append(new GreaterThanOrEqualConstraint(expected));
}
#endregion
#region LessThan
/// <summary>
/// Returns a constraint that tests whether the
/// actual value is less than the suppled argument
/// </summary>
public LessThanConstraint LessThan(object expected)
{
return (LessThanConstraint)this.Append(new LessThanConstraint(expected));
}
#endregion
#region LessThanOrEqualTo
/// <summary>
/// Returns a constraint that tests whether the
/// actual value is less than or equal to the suppled argument
/// </summary>
public LessThanOrEqualConstraint LessThanOrEqualTo(object expected)
{
return (LessThanOrEqualConstraint)this.Append(new LessThanOrEqualConstraint(expected));
}
/// <summary>
/// Returns a constraint that tests whether the
/// actual value is less than or equal to the suppled argument
/// </summary>
public LessThanOrEqualConstraint AtMost(object expected)
{
return (LessThanOrEqualConstraint)this.Append(new LessThanOrEqualConstraint(expected));
}
#endregion
#region TypeOf
/// <summary>
/// Returns a constraint that tests whether the actual
/// value is of the exact type supplied as an argument.
/// </summary>
public ExactTypeConstraint TypeOf(Type expectedType)
{
return (ExactTypeConstraint)this.Append(new ExactTypeConstraint(expectedType));
}
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Returns a constraint that tests whether the actual
/// value is of the exact type supplied as an argument.
/// </summary>
public ExactTypeConstraint TypeOf<T>()
{
return (ExactTypeConstraint)this.Append(new ExactTypeConstraint(typeof(T)));
}
#endif
#endregion
#region InstanceOf
/// <summary>
/// Returns a constraint that tests whether the actual value
/// is of the type supplied as an argument or a derived type.
/// </summary>
public InstanceOfTypeConstraint InstanceOf(Type expectedType)
{
return (InstanceOfTypeConstraint)this.Append(new InstanceOfTypeConstraint(expectedType));
}
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Returns a constraint that tests whether the actual value
/// is of the type supplied as an argument or a derived type.
/// </summary>
public InstanceOfTypeConstraint InstanceOf<T>()
{
return (InstanceOfTypeConstraint)this.Append(new InstanceOfTypeConstraint(typeof(T)));
}
#endif
#endregion
#region AssignableFrom
/// <summary>
/// Returns a constraint that tests whether the actual value
/// is assignable from the type supplied as an argument.
/// </summary>
public AssignableFromConstraint AssignableFrom(Type expectedType)
{
return (AssignableFromConstraint)this.Append(new AssignableFromConstraint(expectedType));
}
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Returns a constraint that tests whether the actual value
/// is assignable from the type supplied as an argument.
/// </summary>
public AssignableFromConstraint AssignableFrom<T>()
{
return (AssignableFromConstraint)this.Append(new AssignableFromConstraint(typeof(T)));
}
#endif
#endregion
#region AssignableTo
/// <summary>
/// Returns a constraint that tests whether the actual value
/// is assignable from the type supplied as an argument.
/// </summary>
public AssignableToConstraint AssignableTo(Type expectedType)
{
return (AssignableToConstraint)this.Append(new AssignableToConstraint(expectedType));
}
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Returns a constraint that tests whether the actual value
/// is assignable from the type supplied as an argument.
/// </summary>
public AssignableToConstraint AssignableTo<T>()
{
return (AssignableToConstraint)this.Append(new AssignableToConstraint(typeof(T)));
}
#endif
#endregion
#region EquivalentTo
/// <summary>
/// Returns a constraint that tests whether the actual value
/// is a collection containing the same elements as the
/// collection supplied as an argument.
/// </summary>
public CollectionEquivalentConstraint EquivalentTo(IEnumerable expected)
{
return (CollectionEquivalentConstraint)this.Append(new CollectionEquivalentConstraint(expected));
}
#endregion
#region SubsetOf
/// <summary>
/// Returns a constraint that tests whether the actual value
/// is a subset of the collection supplied as an argument.
/// </summary>
public CollectionSubsetConstraint SubsetOf(IEnumerable expected)
{
return (CollectionSubsetConstraint)this.Append(new CollectionSubsetConstraint(expected));
}
#endregion
#region Ordered
/// <summary>
/// Returns a constraint that tests whether a collection is ordered
/// </summary>
public CollectionOrderedConstraint Ordered
{
get { return (CollectionOrderedConstraint)this.Append(new CollectionOrderedConstraint()); }
}
#endregion
#region Member
/// <summary>
/// Returns a new CollectionContainsConstraint checking for the
/// presence of a particular object in the collection.
/// </summary>
public CollectionContainsConstraint Member(object expected)
{
return (CollectionContainsConstraint)this.Append(new CollectionContainsConstraint(expected));
}
/// <summary>
/// Returns a new CollectionContainsConstraint checking for the
/// presence of a particular object in the collection.
/// </summary>
public CollectionContainsConstraint Contains(object expected)
{
return (CollectionContainsConstraint)this.Append(new CollectionContainsConstraint(expected));
}
#endregion
#region Contains
/// <summary>
/// Returns a new ContainsConstraint. This constraint
/// will, in turn, make use of the appropriate second-level
/// constraint, depending on the type of the actual argument.
/// This overload is only used if the item sought is a string,
/// since any other type implies that we are looking for a
/// collection member.
/// </summary>
public ContainsConstraint Contains(string expected)
{
return (ContainsConstraint)this.Append(new ContainsConstraint(expected));
}
#endregion
#region StringContaining
/// <summary>
/// Returns a constraint that succeeds if the actual
/// value contains the substring supplied as an argument.
/// </summary>
public SubstringConstraint StringContaining(string expected)
{
return (SubstringConstraint)this.Append(new SubstringConstraint(expected));
}
/// <summary>
/// Returns a constraint that succeeds if the actual
/// value contains the substring supplied as an argument.
/// </summary>
public SubstringConstraint ContainsSubstring(string expected)
{
return (SubstringConstraint)this.Append(new SubstringConstraint(expected));
}
#endregion
#region StartsWith
/// <summary>
/// Returns a constraint that succeeds if the actual
/// value starts with the substring supplied as an argument.
/// </summary>
public StartsWithConstraint StartsWith(string expected)
{
return (StartsWithConstraint)this.Append(new StartsWithConstraint(expected));
}
/// <summary>
/// Returns a constraint that succeeds if the actual
/// value starts with the substring supplied as an argument.
/// </summary>
public StartsWithConstraint StringStarting(string expected)
{
return (StartsWithConstraint)this.Append(new StartsWithConstraint(expected));
}
#endregion
#region EndsWith
/// <summary>
/// Returns a constraint that succeeds if the actual
/// value ends with the substring supplied as an argument.
/// </summary>
public EndsWithConstraint EndsWith(string expected)
{
return (EndsWithConstraint)this.Append(new EndsWithConstraint(expected));
}
/// <summary>
/// Returns a constraint that succeeds if the actual
/// value ends with the substring supplied as an argument.
/// </summary>
public EndsWithConstraint StringEnding(string expected)
{
return (EndsWithConstraint)this.Append(new EndsWithConstraint(expected));
}
#endregion
#region Matches
#if !NETCF
/// <summary>
/// Returns a constraint that succeeds if the actual
/// value matches the regular expression supplied as an argument.
/// </summary>
public RegexConstraint Matches(string pattern)
{
return (RegexConstraint)this.Append(new RegexConstraint(pattern));
}
/// <summary>
/// Returns a constraint that succeeds if the actual
/// value matches the regular expression supplied as an argument.
/// </summary>
public RegexConstraint StringMatching(string pattern)
{
return (RegexConstraint)this.Append(new RegexConstraint(pattern));
}
#endif
#endregion
#region SamePath
/// <summary>
/// Returns a constraint that tests whether the path provided
/// is the same as an expected path after canonicalization.
/// </summary>
public SamePathConstraint SamePath(string expected)
{
return (SamePathConstraint)this.Append(new SamePathConstraint(expected));
}
#endregion
#region SubPath
/// <summary>
/// Returns a constraint that tests whether the path provided
/// is the same path or under an expected path after canonicalization.
/// </summary>
public SubPathConstraint SubPath(string expected)
{
return (SubPathConstraint)this.Append(new SubPathConstraint(expected));
}
#endregion
#region SamePathOrUnder
/// <summary>
/// Returns a constraint that tests whether the path provided
/// is the same path or under an expected path after canonicalization.
/// </summary>
public SamePathOrUnderConstraint SamePathOrUnder(string expected)
{
return (SamePathOrUnderConstraint)this.Append(new SamePathOrUnderConstraint(expected));
}
#endregion
#region InRange
#if CLR_2_0 || CLR_4_0
/// <summary>
/// Returns a constraint that tests whether the actual value falls
/// within a specified range.
/// </summary>
public RangeConstraint<T> InRange<T>(T from, T to) where T : IComparable<T>
{
return (RangeConstraint<T>)this.Append(new RangeConstraint<T>(from, to));
}
#else
/// <summary>
/// Returns a constraint that tests whether the actual value falls
/// within a specified range.
/// </summary>
public RangeConstraint InRange(IComparable from, IComparable to)
{
return (RangeConstraint)this.Append(new RangeConstraint(from, to));
}
#endif
#endregion
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше