Merge pull request #1 from nunit/demo-project
Initial commit of Test Demo
This commit is contained in:
Коммит
2257978aa5
|
@ -0,0 +1,318 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Ignore output folder named package
|
||||
package/
|
||||
|
||||
# Ignore Cake files since they are restored automatically
|
||||
tools/Cake
|
||||
|
||||
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
|
||||
!packages/*/build/
|
||||
# Disable NuGet packages folder
|
||||
packages/
|
||||
# !packages/repositories.config
|
||||
|
||||
# NUnit results
|
||||
TestResult.xml
|
||||
|
||||
# Tools installed by Cake
|
||||
tools/
|
||||
!tools/packages.config
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
#packages/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
|
||||
#LightSwitch generated files
|
||||
GeneratedArtifacts/
|
||||
_Pvt_Extensions/
|
||||
ModelManifest.xml
|
||||
|
||||
# =========================
|
||||
# Windows detritus
|
||||
# =========================
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac desktop service store files
|
||||
.DS_Store
|
||||
*.chk
|
||||
*.jrs
|
||||
*.ide
|
||||
*.ldf
|
||||
*.mdf
|
||||
/Backup
|
||||
/UpgradeLog.htm
|
||||
packages/
|
||||
Backup/
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
*.userosscache
|
||||
*.vcxproj.filters
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
[Dd]ebugPublic/
|
||||
[Rr]eleases/
|
||||
x86/
|
||||
bld/
|
||||
[Ll]og/
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
# DNX
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
**/Properties/launchSettings.json
|
||||
*_i.h
|
||||
*.svclog
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
*.opendb
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
*.sap
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
*.DotSettings.user
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
_NCrunch_*
|
||||
nCrunchTemp_*
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
# Windows Store app package directories and files
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
tools/
|
||||
!tools/packages.config
|
||||
|
||||
# .NET Core
|
||||
.dotnet/
|
|
@ -0,0 +1,46 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at rob@prouse.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
|
@ -0,0 +1,20 @@
|
|||
Copyright (c) 2011-2017 Charlie Poole, 2014-2017 Terje Sandstrom
|
||||
|
||||
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.
|
||||
|
21
README.md
21
README.md
|
@ -1,2 +1,19 @@
|
|||
# nunit3-vs-adapter-demo
|
||||
Demo project used in testing the UI side of the NUnit3 VS adapter
|
||||
# NUnit3 Test Demo #
|
||||
|
||||
The Test Demo is primarily intended to be opened in the IDE for the purpose of viewing the visual treatment of various elements. For that reason, there are failures, warnings and ignored tests as well as successful ones.
|
||||
|
||||
As a secondary purpose, the demos can be run in CI to ensure that the results under VSTest are as expected.
|
||||
|
||||
#### Structure ####
|
||||
|
||||
Each demo is represented by a VS solution containing a single project. This allows a single demo to be opened in the IDE. The project and solution are in the same directory in order to make scripting simpler and all demos are organized at the top level by the version of Visual Studio used to create them.
|
||||
|
||||
Source code is common for all demos and is organized by the language supported.
|
||||
|
||||
#### ExpectXxxx Attributes
|
||||
|
||||
The Test Demo code includes definition of special attributes like `ExpectPass` and `ExpectFailure` for use on the tests. This allows the tester to group the tests by Traits and easily see that the outcome for each group of expectations is what it should be.
|
||||
|
||||
#### C++ Demo ####
|
||||
|
||||
The C++ version of the Demo includes a much smaller number of tests since certain features of NUnit are not directly accessible from C++. More tests may be added as we develop shims for those features.
|
|
@ -0,0 +1,13 @@
|
|||
version: 3.9.{build}
|
||||
image: Visual Studio 2017
|
||||
|
||||
build_script:
|
||||
- ps: .\build.ps1 -Target "Appveyor"
|
||||
|
||||
# disable built-in tests.
|
||||
test: off
|
||||
|
||||
# Holds the build machine open and displays information on how to RDP into the box.
|
||||
# Useful for figuring out why your builds are not working, but comment out when you are done :)
|
||||
#on_finish:
|
||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
@ -0,0 +1,259 @@
|
|||
#tool nuget:?package=vswhere
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ARGUMENTS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
var target = Argument("target", "Default");
|
||||
var configuration = Argument("configuration", "Release");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// DEFINE RUN CONSTANTS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Directories
|
||||
var PROJECT_DIR = Context.Environment.WorkingDirectory.FullPath + "/";
|
||||
var VS2015_DIR = PROJECT_DIR + "solutions/vs2015/";
|
||||
var VS2017_DIR = PROJECT_DIR + "solutions/vs2017/";
|
||||
var TOOLS_DIR = PROJECT_DIR + "tools/";
|
||||
var NET35_ADAPTER_PATH = TOOLS_DIR + "NUnit3TestAdapter/build/net35/";
|
||||
|
||||
// Version of the Adapter to Use
|
||||
var ADAPTER_VERSION = "3.9.0";
|
||||
|
||||
// Get path to VSTest
|
||||
var VSTEST_CONSOLE = VSWhereLatest()?.CombineWithFilePath(
|
||||
"./Common7/IDE/CommonExtensions/Microsoft/TestWindow/vstest.console.exe");
|
||||
|
||||
// Specify all the demo projects
|
||||
var DemoProjects = new DemoProject[] {
|
||||
new DemoProject()
|
||||
{
|
||||
Path = VS2015_DIR + "CSharpTestDemo/CSharpTestDemo.csproj",
|
||||
OutputDir = VS2015_DIR + "CSharpTestDemo/bin/" + configuration + "/",
|
||||
ExpectedResult = "Total tests: 107. Passed: 59. Failed: 24. Skipped: 15."
|
||||
},
|
||||
new DemoProject()
|
||||
{
|
||||
Path = VS2015_DIR + "VbTestDemo/VbTestDemo.vbproj",
|
||||
OutputDir = VS2015_DIR + "VbTestDemo/bin/" + configuration + "/",
|
||||
ExpectedResult = "Total tests: 107. Passed: 59. Failed: 24. Skipped: 15."
|
||||
},
|
||||
new DemoProject()
|
||||
{
|
||||
Path = VS2015_DIR + "CppTestDemo/CppTestDemo.vcxproj",
|
||||
OutputDir = VS2015_DIR + "CppTestDemo/" + configuration + "/",
|
||||
ExpectedResult = "Total tests: 29. Passed: 14. Failed: 5. Skipped: 8."
|
||||
},
|
||||
new DemoProject()
|
||||
{
|
||||
Path = VS2017_DIR + "CSharpTestDemo/CSharpTestDemo.csproj",
|
||||
OutputDir = VS2017_DIR + "CSharpTestDemo/bin/" + configuration + "/",
|
||||
ExpectedResult = "Total tests: 107. Passed: 59. Failed: 24. Skipped: 15."
|
||||
},
|
||||
new DemoProject()
|
||||
{
|
||||
Path = VS2017_DIR + "NUnit3CoreTestDemo/NUnit3CoreTestDemo.csproj",
|
||||
OutputDir = VS2017_DIR + "NUnit3CoreTestDemo/bin/" + configuration + "/",
|
||||
ExpectedResult = "Total tests: 107. Passed: 59. Failed: 24. Skipped: 15."
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CLEAN
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("Clean")
|
||||
.Does(() =>
|
||||
{
|
||||
foreach(var proj in DemoProjects)
|
||||
CleanDirectory(proj.OutputDir);
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// NUGET RESTORE
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("NuGetRestore")
|
||||
.Does(() =>
|
||||
{
|
||||
foreach (var proj in DemoProjects)
|
||||
{
|
||||
if (proj.SupportsRestore)
|
||||
{
|
||||
Information("Restoring NuGet Packages for " + proj.Name);
|
||||
|
||||
if (proj.Name.Contains("Core"))
|
||||
DotNetCoreRestore(proj.Path);
|
||||
else
|
||||
{
|
||||
NuGetRestore(proj.Path,
|
||||
new NuGetRestoreSettings {
|
||||
PackagesDirectory = System.IO.Path.GetDirectoryName(proj.Path) + "/packages"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// BUILD
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("Build")
|
||||
.IsDependentOn("NugetRestore")
|
||||
.Does(() =>
|
||||
{
|
||||
foreach (var proj in DemoProjects)
|
||||
{
|
||||
MSBuild(proj.Path, new MSBuildSettings
|
||||
{
|
||||
Configuration = configuration,
|
||||
EnvironmentVariables = new Dictionary<string, string>(),
|
||||
NodeReuse = false,
|
||||
PlatformTarget = PlatformTarget.MSIL,
|
||||
ToolVersion = proj.ToolVersion
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// INSTALL ADAPTER
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("InstallAdapter")
|
||||
.Does(() =>
|
||||
{
|
||||
Information("Installing NUnit3TestAdapter");
|
||||
|
||||
NuGetInstall("NUnit3TestAdapter",
|
||||
new NuGetInstallSettings()
|
||||
{
|
||||
OutputDirectory = TOOLS_DIR,
|
||||
Version = ADAPTER_VERSION,
|
||||
ExcludeVersion = true
|
||||
});
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// RUN DEMOS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("RunDemos")
|
||||
.IsDependentOn("Build")
|
||||
.IsDependentOn("InstallAdapter")
|
||||
.Does(() =>
|
||||
{
|
||||
foreach(var proj in DemoProjects)
|
||||
{
|
||||
Information("");
|
||||
Information("********************************************************************************************");
|
||||
Information("Demo: " + proj.TestAssembly);
|
||||
Information("********************************************************************************************");
|
||||
Information("");
|
||||
|
||||
if (!proj.Name.Contains("Core"))
|
||||
{
|
||||
IEnumerable<string> redirectedStandardOutput;
|
||||
IEnumerable<string> redirectedErrorOutput;
|
||||
|
||||
int result = StartProcess(
|
||||
VSTEST_CONSOLE,
|
||||
new ProcessSettings()
|
||||
{
|
||||
Arguments = $"{proj.TestAssembly} /TestAdapterPath:{NET35_ADAPTER_PATH}",
|
||||
RedirectStandardOutput = true
|
||||
},
|
||||
out redirectedStandardOutput,
|
||||
out redirectedErrorOutput);
|
||||
|
||||
foreach(string line in redirectedStandardOutput)
|
||||
{
|
||||
Information(line);
|
||||
if (line.StartsWith("Total tests"))
|
||||
proj.ActualResult = line;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Information("Skipping .NET Core demo for now");
|
||||
proj.SkipReason = ".NET Core Project";
|
||||
}
|
||||
}
|
||||
|
||||
Information("");
|
||||
Information("******************************");
|
||||
Information("* Test Demo Summary Report *");
|
||||
Information("******************************");
|
||||
Information("");
|
||||
|
||||
foreach (var proj in DemoProjects)
|
||||
{
|
||||
Information(proj.Path);
|
||||
if (proj.SkipReason != null)
|
||||
{
|
||||
Information(" Skipped: " + proj.SkipReason);
|
||||
}
|
||||
else
|
||||
if (proj.ActualResult == proj.ExpectedResult)
|
||||
{
|
||||
Information(" Passed: " + proj.ExpectedResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
Information("Expected: " + proj.ExpectedResult);
|
||||
Information(" But was: " + proj.ActualResult ?? "<null>");
|
||||
}
|
||||
Information("");
|
||||
}
|
||||
});
|
||||
|
||||
public class DemoProject
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public string OutputDir { get; set; }
|
||||
public string ExpectedResult { get; set; }
|
||||
public string ActualResult { get; set; }
|
||||
public string SkipReason { get; set; }
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return System.IO.Path.GetFileNameWithoutExtension(Path); }
|
||||
}
|
||||
|
||||
public string Type
|
||||
{
|
||||
get { return System.IO.Path.GetExtension(Path); }
|
||||
}
|
||||
|
||||
public string TestAssembly
|
||||
{
|
||||
get { return OutputDir + Name + ".dll"; }
|
||||
}
|
||||
|
||||
public bool SupportsRestore
|
||||
{
|
||||
get { return Type != ".vcxproj"; }
|
||||
}
|
||||
|
||||
public MSBuildToolVersion ToolVersion
|
||||
{
|
||||
get { return Path.Contains("vs2015") ? MSBuildToolVersion.VS2015 : MSBuildToolVersion.VS2017; }
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// TASK TARGETS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("Appveyor")
|
||||
.IsDependentOn("RunDemos");
|
||||
|
||||
Task("Default")
|
||||
.IsDependentOn("Build");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// EXECUTION
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
RunTarget(target);
|
|
@ -0,0 +1,2 @@
|
|||
@echo off
|
||||
powershell ./build.ps1 %CAKE_ARGS% %*
|
|
@ -0,0 +1,88 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
This is a Powershell script to bootstrap a Cake build.
|
||||
.DESCRIPTION
|
||||
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
|
||||
and execute your Cake build script with the parameters you provide.
|
||||
.PARAMETER Target
|
||||
The build script target to run.
|
||||
.PARAMETER Configuration
|
||||
The build configuration to use.
|
||||
.PARAMETER Verbosity
|
||||
Specifies the amount of information to be displayed.
|
||||
.PARAMETER WhatIf
|
||||
Performs a dry run of the build script.
|
||||
No tasks will be executed.
|
||||
.PARAMETER ScriptArgs
|
||||
Remaining arguments are added here.
|
||||
.LINK
|
||||
https://cakebuild.net
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[string]$Target = "Default",
|
||||
[ValidateSet("Release", "Debug")]
|
||||
[string]$Configuration = "Release",
|
||||
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
|
||||
[string]$Verbosity = "Verbose",
|
||||
[switch]$WhatIf,
|
||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||
[string[]]$ScriptArgs
|
||||
)
|
||||
|
||||
$CakeVersion = "0.23.0"
|
||||
$NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
|
||||
|
||||
# Temporarily skip verification and opt-in to new in-proc NuGet
|
||||
$ENV:CAKE_NUGET_USEINPROCESSCLIENT='true'
|
||||
|
||||
# Make sure tools folder exists
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
$ToolPath = Join-Path $PSScriptRoot "tools"
|
||||
if (!(Test-Path $ToolPath)) {
|
||||
Write-Verbose "Creating tools directory..."
|
||||
New-Item -Path $ToolPath -Type directory | out-null
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# INSTALL NUGET
|
||||
###########################################################################
|
||||
|
||||
# Make sure nuget.exe exists.
|
||||
$NugetPath = Join-Path $ToolPath "nuget.exe"
|
||||
if (!(Test-Path $NugetPath)) {
|
||||
Write-Host "Downloading NuGet.exe..."
|
||||
(New-Object System.Net.WebClient).DownloadFile($NugetUrl, $NugetPath);
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# INSTALL CAKE
|
||||
###########################################################################
|
||||
|
||||
# Make sure Cake has been installed.
|
||||
$CakePath = Join-Path $ToolPath "Cake.$CakeVersion/Cake.exe"
|
||||
if (!(Test-Path $CakePath)) {
|
||||
Write-Host "Installing Cake..."
|
||||
Invoke-Expression "&`"$NugetPath`" install Cake -Version $CakeVersion -OutputDirectory `"$ToolPath`"" | Out-Null;
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Throw "An error occurred while restoring Cake from NuGet."
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# RUN BUILD SCRIPT
|
||||
###########################################################################
|
||||
|
||||
# Build the argument list.
|
||||
$Arguments = @{
|
||||
target=$Target;
|
||||
configuration=$Configuration;
|
||||
verbosity=$Verbosity;
|
||||
dryrun=$WhatIf;
|
||||
}.GetEnumerator() | %{"--{0}=`"{1}`"" -f $_.key, $_.value };
|
||||
|
||||
# Start Cake
|
||||
Write-Host "Running build script..."
|
||||
Invoke-Expression "& `"$CakePath`" `"build.cake`" $Arguments $ScriptArgs"
|
||||
exit $LASTEXITCODE
|
|
@ -0,0 +1,113 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NUnitTestDemo</RootNamespace>
|
||||
<AssemblyName>CSharpTestDemo</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</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>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</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>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\src\csharp\ApartmentTests.cs">
|
||||
<Link>ApartmentTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\AsyncTests.cs">
|
||||
<Link>AsyncTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\ConfigFileTests.cs">
|
||||
<Link>ConfigFileTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\ExpectedOutcomeAttributes.cs">
|
||||
<Link>ExpectedOutcomeAttributes.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\GenericTests.cs">
|
||||
<Link>GenericTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\InheritedTestTests.cs">
|
||||
<Link>InheritedTestTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\OneTimeSetUpTests.cs">
|
||||
<Link>OneTimeSetUpTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\ParameterizedTests.cs">
|
||||
<Link>ParameterizedTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\SetUpFixtureTests.cs">
|
||||
<Link>SetUpFixtureTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\SimpleTests.cs">
|
||||
<Link>SimpleTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\TextOutputTests.cs">
|
||||
<Link>TextOutputTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\Theories.cs">
|
||||
<Link>Theories.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\src\App.config">
|
||||
<Link>App.config</Link>
|
||||
</None>
|
||||
<None Include="CSharpTestDemo.runsettings">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- 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,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RunSettings>
|
||||
<!-- Configurations that affect the Test Framework -->
|
||||
<RunConfiguration>
|
||||
<!-- Path relative to solution directory -->
|
||||
<ResultsDirectory>.\TestResults</ResultsDirectory>
|
||||
|
||||
<!-- [x86] | x64
|
||||
- You can also change it from menu Test, Test Settings, Default Processor Architecture -->
|
||||
<TargetPlatform>x86</TargetPlatform>
|
||||
|
||||
<!-- Framework35 | [Framework40] | Framework45 -->
|
||||
<TargetFrameworkVersion>Framework40</TargetFrameworkVersion>
|
||||
|
||||
</RunConfiguration>
|
||||
|
||||
<!-- Parameters used by tests at runtime -->
|
||||
<TestRunParameters>
|
||||
<Parameter name="webAppUrl" value="http://localhost" />
|
||||
<Parameter name="webAppUserName" value="Admin" />
|
||||
<Parameter name="webAppPassword" value="Password" />
|
||||
</TestRunParameters>
|
||||
|
||||
<!-- Adapter Specific sections -->
|
||||
<!--<NUnit>
|
||||
<BasePath>D:\Dev\NUnit\nunit3-vs-adapter\demo\NUnitTestDemo\bin\Release</BasePath>
|
||||
<PrivateBinPath>extras;more.extras</PrivateBinPath>
|
||||
<DefaultTimeout>5000</DefaultTimeout>
|
||||
<WorkDirectory>work</WorkDirectory>
|
||||
<InternalTraceLevel>Info</InternalTraceLevel>
|
||||
<RandomSeed>1234567</RandomSeed>
|
||||
</NUnit>-->
|
||||
|
||||
</RunSettings>
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpTestDemo", "CSharpTestDemo.csproj", "{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,36 @@
|
|||
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("NUnitTestDemo")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NUnitTestDemo")]
|
||||
[assembly: AssemblyCopyright("Copyright © Charlie Poole 2011-2017, Terje Sandstrom 2014-2017")]
|
||||
[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("3ef6f2d9-6425-430b-9a70-83b63087f35a")]
|
||||
|
||||
// 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 Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="3.9.0" targetFramework="net45" />
|
||||
</packages>
|
|
@ -0,0 +1,36 @@
|
|||
using namespace System;
|
||||
using namespace System::Reflection;
|
||||
using namespace System::Runtime::CompilerServices;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
using namespace System::Security::Permissions;
|
||||
|
||||
//
|
||||
// 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:AssemblyTitleAttribute(L"CppTestDemo")];
|
||||
[assembly:AssemblyDescriptionAttribute(L"")];
|
||||
[assembly:AssemblyConfigurationAttribute(L"")];
|
||||
[assembly:AssemblyCompanyAttribute(L"Hewlett-Packard")];
|
||||
[assembly:AssemblyProductAttribute(L"CppTestDemo")];
|
||||
[assembly:AssemblyCopyrightAttribute(L"Copyright (c) Hewlett-Packard 2017")];
|
||||
[assembly:AssemblyTrademarkAttribute(L"")];
|
||||
[assembly:AssemblyCultureAttribute(L"")];
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the value or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly:AssemblyVersionAttribute("1.0.*")];
|
||||
|
||||
[assembly:ComVisible(false)];
|
||||
|
||||
[assembly:CLSCompliantAttribute(true)];
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RunSettings>
|
||||
<!-- Configurations that affect the Test Framework -->
|
||||
<RunConfiguration>
|
||||
<!-- Path relative to solution directory -->
|
||||
<ResultsDirectory>.\TestResults</ResultsDirectory>
|
||||
|
||||
<!-- [x86] | x64
|
||||
- You can also change it from menu Test, Test Settings, Default Processor Architecture -->
|
||||
<TargetPlatform>x86</TargetPlatform>
|
||||
|
||||
<!-- Framework35 | [Framework40] | Framework45 -->
|
||||
<TargetFrameworkVersion>Framework40</TargetFrameworkVersion>
|
||||
|
||||
</RunConfiguration>
|
||||
|
||||
<!-- Parameters used by tests at runtime -->
|
||||
<TestRunParameters>
|
||||
<Parameter name="webAppUrl" value="http://localhost" />
|
||||
<Parameter name="webAppUserName" value="Admin" />
|
||||
<Parameter name="webAppPassword" value="Password" />
|
||||
</TestRunParameters>
|
||||
|
||||
<!-- Adapter Specific sections -->
|
||||
<!--<NUnit>
|
||||
<BasePath>D:\Dev\NUnit\nunit3-vs-adapter\demo\NUnitTestDemo\bin\Release</BasePath>
|
||||
<PrivateBinPath>extras;more.extras</PrivateBinPath>
|
||||
<DefaultTimeout>5000</DefaultTimeout>
|
||||
<WorkDirectory>work</WorkDirectory>
|
||||
<InternalTraceLevel>Info</InternalTraceLevel>
|
||||
<RandomSeed>1234567</RandomSeed>
|
||||
</NUnit>-->
|
||||
|
||||
</RunSettings>
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppTestDemo", "CppTestDemo.vcxproj", "{D4CD9798-8957-431A-8A88-CA9138988CA4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D4CD9798-8957-431A-8A88-CA9138988CA4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D4CD9798-8957-431A-8A88-CA9138988CA4}.Debug|x64.Build.0 = Debug|x64
|
||||
{D4CD9798-8957-431A-8A88-CA9138988CA4}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{D4CD9798-8957-431A-8A88-CA9138988CA4}.Debug|x86.Build.0 = Debug|Win32
|
||||
{D4CD9798-8957-431A-8A88-CA9138988CA4}.Release|x64.ActiveCfg = Release|x64
|
||||
{D4CD9798-8957-431A-8A88-CA9138988CA4}.Release|x64.Build.0 = Release|x64
|
||||
{D4CD9798-8957-431A-8A88-CA9138988CA4}.Release|x86.ActiveCfg = Release|Win32
|
||||
{D4CD9798-8957-431A-8A88-CA9138988CA4}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,160 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{D4CD9798-8957-431A-8A88-CA9138988CA4}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>CppTestDemo</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies />
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies />
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies />
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies />
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\CSharpTestDemo\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\src\App.config" />
|
||||
<None Include="CppTestDemo.runsettings" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\src\cpp\ApartmentTests.cpp" />
|
||||
<ClCompile Include="..\..\..\src\cpp\ConfigFileTests.cpp" />
|
||||
<ClCompile Include="..\..\..\src\cpp\InheritedTestTests.cpp" />
|
||||
<ClCompile Include="..\..\..\src\cpp\OneTimeSetUpTests.cpp" />
|
||||
<ClCompile Include="..\..\..\src\cpp\ParameterizedTests.cpp" />
|
||||
<ClCompile Include="..\..\..\src\cpp\SetUpFixtureTests.cpp" />
|
||||
<ClCompile Include="..\..\..\src\cpp\SimpleTests.cpp" />
|
||||
<ClCompile Include="..\..\..\src\cpp\TextOutputTests.cpp" />
|
||||
<ClCompile Include="..\..\..\src\cpp\Theories.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\src\cpp\ExpectedOutcomeAttributes.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,13 @@
|
|||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>false</MySubMain>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>1</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
|
@ -0,0 +1,35 @@
|
|||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports 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.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("VbTestDemo")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Hewlett-Packard")>
|
||||
<Assembly: AssemblyProduct("VbTestDemo")>
|
||||
<Assembly: AssemblyCopyright("Copyright © Hewlett-Packard 2017")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("ece8a730-b213-49e0-be8b-c1ef879b39a5")>
|
||||
|
||||
' 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 Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
|
@ -0,0 +1,62 @@
|
|||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
'class via a tool like ResGen or Visual Studio.
|
||||
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
'with the /str option, or rebuild your VS project.
|
||||
'''<summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("VbTestDemo.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set(ByVal value As Global.System.Globalization.CultureInfo)
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -0,0 +1,73 @@
|
|||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
|
||||
|
||||
#Region "My.Settings Auto-Save Functionality"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.VbTestDemo.My.MySettings
|
||||
Get
|
||||
Return Global.VbTestDemo.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RunSettings>
|
||||
<!-- Configurations that affect the Test Framework -->
|
||||
<RunConfiguration>
|
||||
<!-- Path relative to solution directory -->
|
||||
<ResultsDirectory>.\TestResults</ResultsDirectory>
|
||||
|
||||
<!-- [x86] | x64
|
||||
- You can also change it from menu Test, Test Settings, Default Processor Architecture -->
|
||||
<TargetPlatform>x86</TargetPlatform>
|
||||
|
||||
<!-- Framework35 | [Framework40] | Framework45 -->
|
||||
<TargetFrameworkVersion>Framework40</TargetFrameworkVersion>
|
||||
|
||||
</RunConfiguration>
|
||||
|
||||
<!-- Parameters used by tests at runtime -->
|
||||
<TestRunParameters>
|
||||
<Parameter name="webAppUrl" value="http://localhost" />
|
||||
<Parameter name="webAppUserName" value="Admin" />
|
||||
<Parameter name="webAppPassword" value="Password" />
|
||||
</TestRunParameters>
|
||||
|
||||
<!-- Adapter Specific sections -->
|
||||
<!--<NUnit>
|
||||
<BasePath>D:\Dev\NUnit\nunit3-vs-adapter\demo\NUnitTestDemo\bin\Release</BasePath>
|
||||
<PrivateBinPath>extras;more.extras</PrivateBinPath>
|
||||
<DefaultTimeout>5000</DefaultTimeout>
|
||||
<WorkDirectory>work</WorkDirectory>
|
||||
<InternalTraceLevel>Info</InternalTraceLevel>
|
||||
<RandomSeed>1234567</RandomSeed>
|
||||
</NUnit>-->
|
||||
|
||||
</RunSettings>
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VbTestDemo", "VbTestDemo.vbproj", "{2F5AD05F-8479-4CD3-A7BE-F657293E773E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2F5AD05F-8479-4CD3-A7BE-F657293E773E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2F5AD05F-8479-4CD3-A7BE-F657293E773E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2F5AD05F-8479-4CD3-A7BE-F657293E773E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2F5AD05F-8479-4CD3-A7BE-F657293E773E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,151 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{2F5AD05F-8479-4CD3-A7BE-F657293E773E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>VbTestDemo</RootNamespace>
|
||||
<AssemblyName>VbTestDemo</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>VbTestDemo.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>VbTestDemo.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\src\vb\ApartmentTests.vb">
|
||||
<Link>ApartmentTests.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\vb\AsyncTests.vb">
|
||||
<Link>AsyncTests.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\vb\ConfigFileTests.vb">
|
||||
<Link>ConfigFileTests.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\vb\ExpectedOutcomeAttributes.vb">
|
||||
<Link>ExpectedOutcomeAttributes.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\vb\GenericTests.vb">
|
||||
<Link>GenericTests.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\vb\InheritedTestTests.vb">
|
||||
<Link>InheritedTestTests.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\vb\OneTimeSetUpTests.vb">
|
||||
<Link>OneTimeSetUpTests.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\vb\ParameterizedTests.vb">
|
||||
<Link>ParameterizedTests.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\vb\SetUpFixtureTests.vb">
|
||||
<Link>SetUpFixtureTests.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\vb\SimpleTests.vb">
|
||||
<Link>SimpleTests.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\vb\TextOutputTests.vb">
|
||||
<Link>TextOutputTests.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\vb\Theories.vb">
|
||||
<Link>Theories.vb</Link>
|
||||
</Compile>
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\src\App.config">
|
||||
<Link>App.config</Link>
|
||||
</None>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<None Include="VbTestDemo.runsettings" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.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,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="3.9.0" targetFramework="net452" />
|
||||
</packages>
|
|
@ -0,0 +1,109 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NUnitTestDemo</RootNamespace>
|
||||
<AssemblyName>CSharpTestDemo</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</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>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</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>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\src\csharp\ApartmentTests.cs">
|
||||
<Link>ApartmentTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\AsyncTests.cs">
|
||||
<Link>AsyncTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\ConfigFileTests.cs">
|
||||
<Link>ConfigFileTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\ExpectedOutcomeAttributes.cs">
|
||||
<Link>ExpectedOutcomeAttributes.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\GenericTests.cs">
|
||||
<Link>GenericTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\InheritedTestTests.cs">
|
||||
<Link>InheritedTestTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\OneTimeSetUpTests.cs">
|
||||
<Link>OneTimeSetUpTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\ParameterizedTests.cs">
|
||||
<Link>ParameterizedTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\SetUpFixtureTests.cs">
|
||||
<Link>SetUpFixtureTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\SimpleTests.cs">
|
||||
<Link>SimpleTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\TextOutputTests.cs">
|
||||
<Link>TextOutputTests.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\src\csharp\Theories.cs">
|
||||
<Link>Theories.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\src\App.config">
|
||||
<Link>App.config</Link>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- 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,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2003
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpTestDemo", "CSharpTestDemo.csproj", "{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{03C3F9EC-FB25-46C0-8F0D-17A0C6E60E9F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {639CEEC8-5273-45A0-8EA5-6E190FFB23D2}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,36 @@
|
|||
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("NUnitTestDemo")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NUnitTestDemo")]
|
||||
[assembly: AssemblyCopyright("Copyright © Charlie Poole 2011-2017, Terje Sandstrom 2014-2017")]
|
||||
[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("3ef6f2d9-6425-430b-9a70-83b63087f35a")]
|
||||
|
||||
// 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 Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="3.9.0" targetFramework="net45" />
|
||||
</packages>
|
|
@ -0,0 +1,34 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\src\csharp\AsyncTests.cs" Link="AsyncTests.cs" />
|
||||
<Compile Include="..\..\..\src\csharp\ExpectedOutcomeAttributes.cs" Link="ExpectedOutcomeAttributes.cs" />
|
||||
<Compile Include="..\..\..\src\csharp\GenericTests.cs" Link="GenericTests.cs" />
|
||||
<Compile Include="..\..\..\src\csharp\InheritedTestTests.cs" Link="InheritedTestTests.cs" />
|
||||
<Compile Include="..\..\..\src\csharp\OneTimeSetUpTests.cs" Link="OneTimeSetUpTests.cs" />
|
||||
<Compile Include="..\..\..\src\csharp\ParameterizedTests.cs" Link="ParameterizedTests.cs" />
|
||||
<Compile Include="..\..\..\src\csharp\SetUpFixtureTests.cs" Link="SetUpFixtureTests.cs" />
|
||||
<Compile Include="..\..\..\src\csharp\SimpleTests.cs" Link="SimpleTests.cs" />
|
||||
<Compile Include="..\..\..\src\csharp\TextOutputTests.cs" Link="TextOutputTests.cs" />
|
||||
<Compile Include="..\..\..\src\csharp\Theories.cs" Link="Theories.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
|
||||
<PackageReference Include="NUnit" Version="3.7.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2003
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NUnit3CoreTestDemo", "NUnit3CoreTestDemo.csproj", "{38F3367C-274D-4B31-9D38-69F949000A61}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{38F3367C-274D-4B31-9D38-69F949000A61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{38F3367C-274D-4B31-9D38-69F949000A61}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{38F3367C-274D-4B31-9D38-69F949000A61}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{38F3367C-274D-4B31-9D38-69F949000A61}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {35AFB295-46B2-49DC-A0B7-952EF6612E13}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="test.setting" value="54321"/>
|
||||
</appSettings>
|
||||
</configuration>
|
|
@ -0,0 +1,27 @@
|
|||
using namespace System;
|
||||
using namespace System::Threading;
|
||||
using namespace NUnit::Framework;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
[Apartment(ApartmentState::STA)]
|
||||
public ref class FixtureWithApartmentAttributeOnClass
|
||||
{
|
||||
public:
|
||||
[Test]
|
||||
void TestMethodInSTAFixture()
|
||||
{
|
||||
Assert::That(Thread::CurrentThread->GetApartmentState(), Is::EqualTo(ApartmentState::STA));
|
||||
}
|
||||
};
|
||||
|
||||
public ref class FixtureWithApartmentAttributeOnMethod
|
||||
{
|
||||
public:
|
||||
[Test, Apartment(ApartmentState::STA)]
|
||||
void TestMethodInSTA()
|
||||
{
|
||||
Assert::That(Thread::CurrentThread->GetApartmentState(), Is::EqualTo(ApartmentState::STA));
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
#include "ExpectedOutcomeAttributes.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Configuration;
|
||||
using namespace System::IO;
|
||||
using namespace NUnit::Framework;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
[ExpectPass]
|
||||
public class ConfigFileTests
|
||||
{
|
||||
public:
|
||||
[Test]
|
||||
static void ProperConfigFileIsUsed()
|
||||
{
|
||||
String^ expectedPath = Path::Combine(TestContext::CurrentContext->TestDirectory, "CppTestDemo.dll.config");
|
||||
Assert::That(AppDomain::CurrentDomain->SetupInformation->ConfigurationFile, Is::EqualTo(expectedPath));
|
||||
}
|
||||
|
||||
[Test]
|
||||
static void CanReadConfigFile()
|
||||
{
|
||||
Assert::That(ConfigurationManager::AppSettings->Get("test.setting"), Is::EqualTo("54321"));
|
||||
}
|
||||
|
||||
};
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
using namespace System;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::Text;
|
||||
using namespace System::Threading::Tasks;
|
||||
using namespace NUnit::Framework;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
public ref class ExpectPassAttribute : PropertyAttribute
|
||||
{
|
||||
public:
|
||||
ExpectPassAttribute() : PropertyAttribute("Expect", "Pass") { }
|
||||
};
|
||||
|
||||
public ref class ExpectFailureAttribute : PropertyAttribute
|
||||
{
|
||||
public:
|
||||
ExpectFailureAttribute() : PropertyAttribute("Expect", "Failure") { }
|
||||
};
|
||||
|
||||
public ref class ExpectWarningAttribute : PropertyAttribute
|
||||
{
|
||||
public:
|
||||
ExpectWarningAttribute() : PropertyAttribute("Expect", "Warning") { }
|
||||
};
|
||||
|
||||
public ref class ExpectIgnoreAttribute : PropertyAttribute
|
||||
{
|
||||
public:
|
||||
ExpectIgnoreAttribute() : PropertyAttribute("Expect", "Ignore") { }
|
||||
};
|
||||
|
||||
public ref class ExpectSkipAttribute : PropertyAttribute
|
||||
{
|
||||
public:
|
||||
ExpectSkipAttribute() : PropertyAttribute("Expect", "Skipped") { }
|
||||
};
|
||||
|
||||
public ref class ExpectErrorAttribute : PropertyAttribute
|
||||
{
|
||||
public:
|
||||
ExpectErrorAttribute() : PropertyAttribute("Expect", "Error") { }
|
||||
};
|
||||
|
||||
public ref class ExpectInconclusiveAttribute : PropertyAttribute
|
||||
{
|
||||
public:
|
||||
ExpectInconclusiveAttribute() : PropertyAttribute("Expect", "Inconclusive") { }
|
||||
};
|
||||
|
||||
public ref class ExpectMixedAttribute : PropertyAttribute
|
||||
{
|
||||
public:
|
||||
ExpectMixedAttribute() : PropertyAttribute("Expect", "Mixed") { }
|
||||
};
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
using namespace System;
|
||||
using namespace NUnit::Framework;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
public ref class InheritedTestBaseClass
|
||||
{
|
||||
public:
|
||||
[Test]
|
||||
void TestInBaseClass()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
public ref class InheritedTestDerivedClass : InheritedTestBaseClass
|
||||
{
|
||||
};
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
#include "ExpectedOutcomeAttributes.h"
|
||||
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::Text;
|
||||
using namespace NUnit::Framework;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
[TestFixture, ExpectPass]
|
||||
public ref class OneTimeSetUpTests
|
||||
{
|
||||
private:
|
||||
int SetUpCount;
|
||||
int TearDownCount;
|
||||
|
||||
public:
|
||||
[OneTimeSetUp]
|
||||
void BeforeTests()
|
||||
{
|
||||
Assert::That(SetUpCount, Is::EqualTo(0));
|
||||
Assert::That(TearDownCount, Is::EqualTo(0));
|
||||
SetUpCount++;
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
void AfterTests()
|
||||
{
|
||||
Assert::That(SetUpCount, Is::EqualTo(1), "Unexpected error");
|
||||
Assert::That(TearDownCount, Is::EqualTo(0));
|
||||
TearDownCount++;
|
||||
}
|
||||
|
||||
[Test]
|
||||
void Test1()
|
||||
{
|
||||
Assert::That(SetUpCount, Is::EqualTo(1));
|
||||
Assert::That(TearDownCount, Is::EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
void Test2()
|
||||
{
|
||||
Assert::That(SetUpCount, Is::EqualTo(1));
|
||||
Assert::That(TearDownCount, Is::EqualTo(0));
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
#include "ExpectedOutcomeAttributes.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::Text;
|
||||
using namespace NUnit::Framework;
|
||||
using namespace NUnit::Framework::Internal;
|
||||
using namespace NUnit::Framework::Interfaces;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
public class ParameterizedTests
|
||||
{
|
||||
public:
|
||||
[ExpectPass]
|
||||
[TestCase(2, 2, 4)]
|
||||
[TestCase(0, 5, 5)]
|
||||
[TestCase(31, 11, 42)]
|
||||
void TestCaseSucceeds(int a, int b, int sum)
|
||||
{
|
||||
Assert::That(a + b, Is::EqualTo(sum));
|
||||
}
|
||||
|
||||
[ExpectPass]
|
||||
[TestCase(2, 2, ExpectedResult = 4)]
|
||||
[TestCase(0, 5, ExpectedResult = 5)]
|
||||
[TestCase(31, 11, ExpectedResult = 42)]
|
||||
int TestCaseSucceeds_Result(int a, int b)
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
[ExpectFailure]
|
||||
[TestCase(31, 11, 99)]
|
||||
void TestCaseFails(int a, int b, int sum)
|
||||
{
|
||||
Assert::That(a + b, Is::EqualTo(sum));
|
||||
}
|
||||
|
||||
[ExpectWarning]
|
||||
[TestCase(31, 11, 99)]
|
||||
void TestCaseWarns(int a, int b, int sum)
|
||||
{
|
||||
Warn::Unless(a + b, Is::EqualTo(sum));
|
||||
}
|
||||
|
||||
[ExpectWarning]
|
||||
[TestCase(31, 11, 99)]
|
||||
void TestCaseWarnsThreeTimes(int a, int b, int answer)
|
||||
{
|
||||
Warn::Unless(a + b, Is::EqualTo(answer), "Bad sum");
|
||||
Warn::Unless(a - b, Is::EqualTo(answer), "Bad difference");
|
||||
Warn::Unless(a * b, Is::EqualTo(answer), "Bad product");
|
||||
}
|
||||
|
||||
[TestCase(31, 11, ExpectedResult = 99), ExpectFailure]
|
||||
int TestCaseFails_Result(int a, int b)
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
[TestCase(31, 11), ExpectInconclusive]
|
||||
void TestCaseIsInconclusive(int a, int b)
|
||||
{
|
||||
Assert::Inconclusive("Inconclusive test case");
|
||||
}
|
||||
|
||||
[Ignore("Ignored test"), ExpectIgnore]
|
||||
[TestCase(31, 11)]
|
||||
void TestCaseIsIgnored_Attribute(int a, int b)
|
||||
{
|
||||
}
|
||||
|
||||
[TestCase(31, 11, Ignore = "Ignoring this"), ExpectIgnore]
|
||||
void TestCaseIsIgnored_Property(int a, int b)
|
||||
{
|
||||
}
|
||||
|
||||
[TestCase(31, 11), ExpectIgnore]
|
||||
void TestCaseIsIgnored_Assert(int a, int b)
|
||||
{
|
||||
Assert::Ignore("Ignoring this test case");
|
||||
}
|
||||
|
||||
#if !NETCOREAPP1_1
|
||||
[TestCase(31, 11, ExcludePlatform="NET"), ExpectSkip]
|
||||
void TestCaseIsSkipped_Property(int a, int b)
|
||||
{
|
||||
}
|
||||
|
||||
[Platform(Exclude = "NET"), ExpectSkip]
|
||||
[TestCase(31, 11)]
|
||||
void TestCaseIsSkipped_Attribute(int a, int b)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
[Explicit, ExpectSkip]
|
||||
[TestCase(31, 11)]
|
||||
void TestCaseIsExplicit(int a, int b)
|
||||
{
|
||||
}
|
||||
|
||||
[TestCase(31, 11), ExpectError]
|
||||
void TestCaseThrowsException(int a, int b)
|
||||
{
|
||||
throw gcnew Exception("Exception from test case");
|
||||
}
|
||||
|
||||
[TestCase(42, TestName="AlternateTestName"), ExpectPass]
|
||||
void TestCaseWithAlternateName(int x)
|
||||
{
|
||||
}
|
||||
|
||||
[TestCase(42, TestName="NameWithSpecialChar->Here")]
|
||||
void TestCaseWithSpecialCharInName(int x)
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
void TestCaseWithRandomParameter([Random(1)] int x)
|
||||
{
|
||||
}
|
||||
|
||||
#if false // Test for issue #144
|
||||
[MyTestCase]
|
||||
void TestCaseWithBadTestBuilder(string baz)
|
||||
{
|
||||
Assert.That(baz, Is.EqualTo("baz"));
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
|
||||
class MyTestCaseAttribute : Attribute, ITestBuilder
|
||||
{
|
||||
public IEnumerable<TestMethod> BuildFrom(IMethodInfo method, Test suite)
|
||||
{
|
||||
throw new InvalidOperationException("This is intentionally broken");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
#include "ExpectedOutcomeAttributes.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::Text;
|
||||
using namespace NUnit::Framework;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
namespace SetUpFixture
|
||||
{
|
||||
[SetUpFixture]
|
||||
public ref class SetUpFixture
|
||||
{
|
||||
public:
|
||||
static int SetUpCount;
|
||||
static int TearDownCount;
|
||||
|
||||
[OneTimeSetUp]
|
||||
void BeforeTests()
|
||||
{
|
||||
Assert::That(SetUpCount, Is::EqualTo(0));
|
||||
SetUpCount++;
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
void AfterTests()
|
||||
{
|
||||
Assert::That(TearDownCount, Is::EqualTo(0));
|
||||
TearDownCount++;
|
||||
}
|
||||
};
|
||||
|
||||
[TestFixture, ExpectPass]
|
||||
public ref class TestFixture1
|
||||
{
|
||||
public:
|
||||
[Test]
|
||||
void Test1()
|
||||
{
|
||||
Assert::That(SetUpFixture::SetUpCount, Is::EqualTo(1));
|
||||
Assert::That(SetUpFixture::TearDownCount, Is::EqualTo(0));
|
||||
}
|
||||
};
|
||||
|
||||
[TestFixture, ExpectPass]
|
||||
public ref class TestFixture2
|
||||
{
|
||||
[Test]
|
||||
void Test2()
|
||||
{
|
||||
Assert::That(SetUpFixture::SetUpCount, Is::EqualTo(1));
|
||||
Assert::That(SetUpFixture::TearDownCount, Is::EqualTo(0));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
#include "ExpectedOutcomeAttributes.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::Text;
|
||||
using namespace NUnit::Framework;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
public ref class SimpleTests
|
||||
{
|
||||
public:
|
||||
[Test, ExpectPass]
|
||||
void TestSucceeds()
|
||||
{
|
||||
Console::WriteLine("Simple test running");
|
||||
Assert::That(2 + 2, Is::EqualTo(4));
|
||||
}
|
||||
|
||||
[Test, ExpectPass]
|
||||
void TestSucceeds_Message()
|
||||
{
|
||||
Assert::That(2 + 2, Is::EqualTo(4));
|
||||
Assert::Pass("Simple arithmetic!");
|
||||
}
|
||||
|
||||
[Test, ExpectFailure]
|
||||
void TestFails()
|
||||
{
|
||||
Assert::That(2 + 2, Is::EqualTo(5));
|
||||
}
|
||||
|
||||
[Test, ExpectWarning]
|
||||
void TestWarns()
|
||||
{
|
||||
Assert::Warn("This is a warning");
|
||||
}
|
||||
|
||||
[Test, ExpectWarning]
|
||||
void TestWarnsThreeTimes()
|
||||
{
|
||||
Assert::Warn("Warning 1");
|
||||
Assert::Warn("Warning 2");
|
||||
Assert::Warn("Warning 3");
|
||||
}
|
||||
|
||||
//[Test, ExpectFailure]
|
||||
//void TestWithThreeFailures()
|
||||
//{
|
||||
// Assert::Multiple(() =>
|
||||
// {
|
||||
// Assert::Fail("Failure 1");
|
||||
// Assert::That(2 + 2, Is::EqualTo(5), "Failure 2");
|
||||
// Assert::That(42, Is::GreaterThan(99), "Failure 3");
|
||||
// });
|
||||
//}
|
||||
|
||||
//[Test, ExpectFailure]
|
||||
//void TestWithTwoFailuresAndAnError()
|
||||
//{
|
||||
// Assert::Multiple(() =>
|
||||
// {
|
||||
// Assert.That(2 + 2, Is.EqualTo(5));
|
||||
// Assert.That(42, Is.GreaterThan(99));
|
||||
// throw new Exception("Throwing after two failures");
|
||||
// });
|
||||
//}
|
||||
|
||||
[Test, ExpectFailure]
|
||||
void TestWithFailureAndWarning()
|
||||
{
|
||||
Assert::Warn("WARNING!");
|
||||
Assert::Fail("FAILING!");
|
||||
}
|
||||
|
||||
[Test, ExpectFailure]
|
||||
void TestWithTwoFailuresAndAWarning()
|
||||
{
|
||||
Warn::Unless(2 + 2 == 5, "Math is too hard!");
|
||||
|
||||
//Assert::Multiple(() =>
|
||||
//{
|
||||
// Assert::That(2 + 2, Is.EqualTo(5));
|
||||
// Assert::That(42, Is.GreaterThan(99));
|
||||
//});
|
||||
}
|
||||
|
||||
[Test, ExpectFailure]
|
||||
void TestFails_StringEquality()
|
||||
{
|
||||
Assert::That("Hello" + "World" + "!", Is::EqualTo("Hello World!"));
|
||||
}
|
||||
|
||||
[Test, ExpectInconclusive]
|
||||
void TestIsInconclusive()
|
||||
{
|
||||
Assert::Inconclusive("Testing");
|
||||
}
|
||||
|
||||
[Test, Ignore("Ignoring this test deliberately"), ExpectIgnore]
|
||||
void TestIsIgnored_Attribute()
|
||||
{
|
||||
}
|
||||
|
||||
[Test, ExpectIgnore]
|
||||
void TestIsIgnored_Assert()
|
||||
{
|
||||
Assert::Ignore("Ignoring this test deliberately");
|
||||
}
|
||||
|
||||
#if !NETCOREAPP1_1
|
||||
// Since we only run under .NET, test is always excluded
|
||||
[Test, ExpectSkip, Platform(Exclude="NET")]
|
||||
void TestIsSkipped_Platform()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test, ExpectSkip, Explicit]
|
||||
void TestIsExplicit()
|
||||
{
|
||||
}
|
||||
|
||||
[Test, ExpectError]
|
||||
void TestThrowsException()
|
||||
{
|
||||
throw gcnew Exception("Deliberate exception thrown");
|
||||
}
|
||||
|
||||
[Test, ExpectPass]
|
||||
[Property("Priority", "High")]
|
||||
void TestWithProperty()
|
||||
{
|
||||
}
|
||||
|
||||
[Test, ExpectPass]
|
||||
[Property("Priority", "Low")]
|
||||
[Property("Action", "Ignore")]
|
||||
void TestWithTwoProperties()
|
||||
{
|
||||
}
|
||||
|
||||
[Test, ExpectPass]
|
||||
[Category("Slow")]
|
||||
void TestWithCategory()
|
||||
{
|
||||
}
|
||||
|
||||
[Test, ExpectPass]
|
||||
[Category("Slow")]
|
||||
[Category("Data")]
|
||||
void TestWithTwoCategories()
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
#include "ExpectedOutcomeAttributes.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::IO;
|
||||
using namespace System::Reflection;
|
||||
using namespace System::Text;
|
||||
using namespace NUnit::Framework;
|
||||
using namespace System::Diagnostics;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
[ExpectPass]
|
||||
public class TextOutputTests
|
||||
{
|
||||
public:
|
||||
[Test]
|
||||
void WriteToConsole()
|
||||
{
|
||||
Console::WriteLine("This is Console line 1");
|
||||
Console::WriteLine("This is Console line 2\nThis is Console line 3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
void WriteToError()
|
||||
{
|
||||
Console::Error->WriteLine("This is Error line 1");
|
||||
Console::Error->WriteLine("This is Error line 2\nThis is Error line 3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
void WriteToTestContext()
|
||||
{
|
||||
TestContext::WriteLine("Line 1 to TestContext");
|
||||
TestContext::WriteLine("Line 2 to TestContext\nLine 3 to TestContext");
|
||||
}
|
||||
|
||||
[Test]
|
||||
void WriteToTestContextOut()
|
||||
{
|
||||
TestContext::Out->WriteLine("Line 1 to TestContext.Out");
|
||||
TestContext::Out->WriteLine("Line 2 to TestContext.Out\nLine 3 to TestContext.Out");
|
||||
}
|
||||
|
||||
[Test]
|
||||
void WriteToTestContextError()
|
||||
{
|
||||
TestContext::Error->WriteLine("Line 1 to TestContext.Error");
|
||||
TestContext::Error->WriteLine("Line 2 to TestContext.Error\nLine 3 to TestContext.Error");
|
||||
}
|
||||
|
||||
[Test]
|
||||
void WriteToTestContextProgress()
|
||||
{
|
||||
TestContext::Progress->WriteLine("Line 1 to TestContext.Progress");
|
||||
TestContext::Progress->WriteLine("Line 2 to TestContext.Progress\nLine 3 to TestContext.Progress");
|
||||
}
|
||||
|
||||
[Test]
|
||||
void WriteToTrace()
|
||||
{
|
||||
Trace::Write("This is Trace line 1");
|
||||
Trace::Write("This is Trace line 2");
|
||||
Trace::Write("This is Trace line 3");
|
||||
}
|
||||
|
||||
[Test, Description("Displays various settings for verification")]
|
||||
void DisplayTestSettings()
|
||||
{
|
||||
#if NETCOREAPP1_1
|
||||
Console::WriteLine("CurrentDirectory={0}", Directory.GetCurrentDirectory());
|
||||
Console::WriteLine("Location={0}", typeof(TextOutputTests).GetTypeInfo().Assembly.Location);
|
||||
#else
|
||||
Console::WriteLine("CurrentDirectory={0}", Environment::CurrentDirectory);
|
||||
Console::WriteLine("BasePath={0}", AppDomain::CurrentDomain->BaseDirectory);
|
||||
Console::WriteLine("PrivateBinPath={0}", AppDomain::CurrentDomain->SetupInformation->PrivateBinPath);
|
||||
#endif
|
||||
Console::WriteLine("WorkDirectory={0}", TestContext::CurrentContext->WorkDirectory);
|
||||
Console::WriteLine("DefaultTimeout={0}", NUnit::Framework::Internal::TestExecutionContext::CurrentContext->TestCaseTimeout);
|
||||
}
|
||||
|
||||
[Test]
|
||||
void DisplayTestParameters()
|
||||
{
|
||||
if (TestContext::Parameters->Count == 0)
|
||||
Console::WriteLine("No TestParameters were passed");
|
||||
else
|
||||
for each (String^ name in TestContext::Parameters->Names)
|
||||
Console::WriteLine("Parameter: {0} = {1}", name, TestContext::Parameters->Get(name));
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#include "ExpectedOutcomeAttributes.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::Text;
|
||||
using namespace NUnit::Framework;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
public class Theories
|
||||
{
|
||||
private:
|
||||
[Datapoints]
|
||||
int data[3] = { 0, 1, 42 };
|
||||
|
||||
public:
|
||||
[Theory, ExpectPass]
|
||||
void Theory_AllCasesSucceed(int a, int b)
|
||||
{
|
||||
Assert::That(a + b, Is::EqualTo(b + a));
|
||||
}
|
||||
|
||||
[Theory, ExpectMixed]
|
||||
void Theory_SomeCasesAreInconclusive(int a, int b)
|
||||
{
|
||||
Assume::That(b != 0);
|
||||
}
|
||||
|
||||
[Theory, ExpectMixed]
|
||||
void Theory_SomeCasesFail(int a, int b)
|
||||
{
|
||||
Assert::That(b != 0);
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
[Apartment(ApartmentState.STA)]
|
||||
public class FixtureWithApartmentAttributeOnClass
|
||||
{
|
||||
[Test]
|
||||
public void TestMethodInSTAFixture()
|
||||
{
|
||||
Assert.That(Thread.CurrentThread.GetApartmentState(), Is.EqualTo(ApartmentState.STA));
|
||||
}
|
||||
}
|
||||
|
||||
public class FixtureWithApartmentAttributeOnMethod
|
||||
{
|
||||
[Test, Apartment(ApartmentState.STA)]
|
||||
public void TestMethodInSTA()
|
||||
{
|
||||
Assert.That(Thread.CurrentThread.GetApartmentState(), Is.EqualTo(ApartmentState.STA));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if NETCOREAPP1_1
|
||||
namespace NUnitCoreTestDemo
|
||||
#else
|
||||
namespace NUnitTestDemo
|
||||
#endif
|
||||
{
|
||||
public class AsyncTests
|
||||
{
|
||||
[Test, ExpectError]
|
||||
public async void AsyncVoidTestIsInvalid()
|
||||
{
|
||||
var result = await ReturnOne();
|
||||
|
||||
Assert.AreEqual(1, result);
|
||||
}
|
||||
|
||||
[Test, ExpectPass]
|
||||
public async Task AsyncTaskTestSucceeds()
|
||||
{
|
||||
var result = await ReturnOne();
|
||||
|
||||
Assert.AreEqual(1, result);
|
||||
}
|
||||
|
||||
[Test, ExpectFailure]
|
||||
public async Task AsyncTaskTestFails()
|
||||
{
|
||||
var result = await ReturnOne();
|
||||
|
||||
Assert.AreEqual(2, result);
|
||||
}
|
||||
|
||||
[Test, ExpectError]
|
||||
public async Task AsyncTaskTestThrowsException()
|
||||
{
|
||||
await ThrowException();
|
||||
|
||||
Assert.Fail("Should never get here");
|
||||
}
|
||||
|
||||
[TestCase(ExpectedResult = 1), ExpectPass]
|
||||
public async Task<int> AsyncTaskWithResultSucceeds()
|
||||
{
|
||||
return await ReturnOne();
|
||||
}
|
||||
|
||||
[TestCase(ExpectedResult = 2), ExpectFailure]
|
||||
public async Task<int> AsyncTaskWithResultFails()
|
||||
{
|
||||
return await ReturnOne();
|
||||
}
|
||||
|
||||
[TestCase(ExpectedResult = 0), ExpectError]
|
||||
public async Task<int> AsyncTaskWithResultThrowsException()
|
||||
{
|
||||
return await ThrowException();
|
||||
}
|
||||
|
||||
private static Task<int> ReturnOne()
|
||||
{
|
||||
return Task.Run(() => 1);
|
||||
}
|
||||
|
||||
#pragma warning disable 162
|
||||
private static Task<int> ThrowException()
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
#pragma warning restore 162
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace NUnitTestDemo
|
||||
{
|
||||
[ExpectPass]
|
||||
public class ConfigFileTests
|
||||
{
|
||||
[Test]
|
||||
public static void ProperConfigFileIsUsed()
|
||||
{
|
||||
var expectedPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "CSharpTestDemo.dll.config");
|
||||
Assert.That(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, Is.EqualTo(expectedPath));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void CanReadConfigFile()
|
||||
{
|
||||
Assert.That(ConfigurationManager.AppSettings.Get("test.setting"), Is.EqualTo("54321"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if NETCOREAPP1_1
|
||||
namespace NUnitCoreTestDemo
|
||||
#else
|
||||
namespace NUnitTestDemo
|
||||
#endif
|
||||
{
|
||||
public class ExpectPassAttribute : PropertyAttribute
|
||||
{
|
||||
public ExpectPassAttribute() : base("Expect", "Pass") { }
|
||||
}
|
||||
|
||||
|
||||
public class ExpectFailureAttribute : PropertyAttribute
|
||||
{
|
||||
public ExpectFailureAttribute() : base("Expect", "Failure") { }
|
||||
}
|
||||
|
||||
public class ExpectWarningAttribute : PropertyAttribute
|
||||
{
|
||||
public ExpectWarningAttribute() : base("Expect", "Warning") { }
|
||||
}
|
||||
|
||||
public class ExpectIgnoreAttribute : PropertyAttribute
|
||||
{
|
||||
public ExpectIgnoreAttribute() : base("Expect", "Ignore") { }
|
||||
}
|
||||
|
||||
public class ExpectSkipAttribute : PropertyAttribute
|
||||
{
|
||||
public ExpectSkipAttribute() : base("Expect", "Skipped") { }
|
||||
}
|
||||
|
||||
public class ExpectErrorAttribute : PropertyAttribute
|
||||
{
|
||||
public ExpectErrorAttribute() : base("Expect", "Error") { }
|
||||
}
|
||||
|
||||
public class ExpectInconclusiveAttribute : PropertyAttribute
|
||||
{
|
||||
public ExpectInconclusiveAttribute() : base("Expect", "Inconclusive") { }
|
||||
}
|
||||
|
||||
public class ExpectMixedAttribute : PropertyAttribute
|
||||
{
|
||||
public ExpectMixedAttribute() : base("Expect", "Mixed") { }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if NETCOREAPP1_1
|
||||
namespace NUnitCoreTestDemo
|
||||
#else
|
||||
namespace NUnitTestDemo
|
||||
#endif
|
||||
{
|
||||
[TestFixture(typeof(int))]
|
||||
public class GenericTests<T>
|
||||
{
|
||||
[Test, ExpectPass]
|
||||
public void TestIt() { }
|
||||
}
|
||||
|
||||
[ExpectPass]
|
||||
[TestFixture(typeof(ArrayList))]
|
||||
[TestFixture(typeof(List<int>))]
|
||||
public class GenericTests_IList<TList> where TList : IList, new()
|
||||
{
|
||||
private IList list;
|
||||
|
||||
[SetUp]
|
||||
public void CreateList()
|
||||
{
|
||||
this.list = new TList();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanAddToList()
|
||||
{
|
||||
list.Add(1); list.Add(2); list.Add(3);
|
||||
Assert.AreEqual(3, list.Count);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if NETCOREAPP1_1
|
||||
namespace NUnitCoreTestDemo
|
||||
#else
|
||||
namespace NUnitTestDemo
|
||||
#endif
|
||||
{
|
||||
public abstract class InheritedTestBaseClass
|
||||
{
|
||||
[Test]
|
||||
public void TestInBaseClass()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class InheritedTestDerivedClass : InheritedTestBaseClass
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if NETCOREAPP1_1
|
||||
namespace NUnitCoreTestDemo
|
||||
#else
|
||||
namespace NUnitTestDemo
|
||||
#endif
|
||||
{
|
||||
[TestFixture, ExpectPass]
|
||||
public class OneTimeSetUpTests
|
||||
{
|
||||
int SetUpCount;
|
||||
int TearDownCount;
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void BeforeTests()
|
||||
{
|
||||
Assert.That(SetUpCount, Is.EqualTo(0));
|
||||
Assert.That(TearDownCount, Is.EqualTo(0));
|
||||
SetUpCount++;
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public void AfterTests()
|
||||
{
|
||||
Assert.That(SetUpCount, Is.EqualTo(1), "Unexpected error");
|
||||
Assert.That(TearDownCount, Is.EqualTo(0));
|
||||
TearDownCount++;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test1()
|
||||
{
|
||||
Assert.That(SetUpCount, Is.EqualTo(1));
|
||||
Assert.That(TearDownCount, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test2()
|
||||
{
|
||||
Assert.That(SetUpCount, Is.EqualTo(1));
|
||||
Assert.That(TearDownCount, Is.EqualTo(0));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.Internal;
|
||||
using NUnit.Framework.Interfaces;
|
||||
|
||||
#if NETCOREAPP1_1
|
||||
namespace NUnitCoreTestDemo
|
||||
#else
|
||||
namespace NUnitTestDemo
|
||||
#endif
|
||||
{
|
||||
public class ParameterizedTests
|
||||
{
|
||||
[ExpectPass]
|
||||
[TestCase(2, 2, 4)]
|
||||
[TestCase(0, 5, 5)]
|
||||
[TestCase(31, 11, 42)]
|
||||
public void TestCaseSucceeds(int a, int b, int sum)
|
||||
{
|
||||
Assert.That(a + b, Is.EqualTo(sum));
|
||||
}
|
||||
|
||||
[ExpectPass]
|
||||
[TestCase(2, 2, ExpectedResult = 4)]
|
||||
[TestCase(0, 5, ExpectedResult = 5)]
|
||||
[TestCase(31, 11, ExpectedResult = 42)]
|
||||
public int TestCaseSucceeds_Result(int a, int b)
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
[ExpectFailure]
|
||||
[TestCase(31, 11, 99)]
|
||||
public void TestCaseFails(int a, int b, int sum)
|
||||
{
|
||||
Assert.That(a + b, Is.EqualTo(sum));
|
||||
}
|
||||
|
||||
[ExpectWarning]
|
||||
[TestCase(31, 11, 99)]
|
||||
public void TestCaseWarns(int a, int b, int sum)
|
||||
{
|
||||
Warn.Unless(a + b, Is.EqualTo(sum));
|
||||
}
|
||||
|
||||
[ExpectWarning]
|
||||
[TestCase(31, 11, 99)]
|
||||
public void TestCaseWarnsThreeTimes(int a, int b, int answer)
|
||||
{
|
||||
Warn.Unless(a + b, Is.EqualTo(answer), "Bad sum");
|
||||
Warn.Unless(a - b, Is.EqualTo(answer), "Bad difference");
|
||||
Warn.Unless(a * b, Is.EqualTo(answer), "Bad product");
|
||||
}
|
||||
|
||||
[TestCase(31, 11, ExpectedResult = 99), ExpectFailure]
|
||||
public int TestCaseFails_Result(int a, int b)
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
[TestCase(31, 11), ExpectInconclusive]
|
||||
public void TestCaseIsInconclusive(int a, int b)
|
||||
{
|
||||
Assert.Inconclusive("Inconclusive test case");
|
||||
}
|
||||
|
||||
[Ignore("Ignored test"), ExpectIgnore]
|
||||
[TestCase(31, 11)]
|
||||
public void TestCaseIsIgnored_Attribute(int a, int b)
|
||||
{
|
||||
}
|
||||
|
||||
[TestCase(31, 11, Ignore = "Ignoring this"), ExpectIgnore]
|
||||
public void TestCaseIsIgnored_Property(int a, int b)
|
||||
{
|
||||
}
|
||||
|
||||
[TestCase(31, 11), ExpectIgnore]
|
||||
public void TestCaseIsIgnored_Assert(int a, int b)
|
||||
{
|
||||
Assert.Ignore("Ignoring this test case");
|
||||
}
|
||||
|
||||
#if !NETCOREAPP1_1
|
||||
[TestCase(31, 11, ExcludePlatform="NET"), ExpectSkip]
|
||||
public void TestCaseIsSkipped_Property(int a, int b)
|
||||
{
|
||||
}
|
||||
|
||||
[Platform(Exclude = "NET"), ExpectSkip]
|
||||
[TestCase(31, 11)]
|
||||
public void TestCaseIsSkipped_Attribute(int a, int b)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
[Explicit, ExpectSkip]
|
||||
[TestCase(31, 11)]
|
||||
public void TestCaseIsExplicit(int a, int b)
|
||||
{
|
||||
}
|
||||
|
||||
[TestCase(31, 11), ExpectError]
|
||||
public void TestCaseThrowsException(int a, int b)
|
||||
{
|
||||
throw new Exception("Exception from test case");
|
||||
}
|
||||
|
||||
[TestCase(42, TestName="AlternateTestName"), ExpectPass]
|
||||
public void TestCaseWithAlternateName(int x)
|
||||
{
|
||||
}
|
||||
|
||||
[TestCase(42, TestName="NameWithSpecialChar->Here")]
|
||||
public void TestCaseWithSpecialCharInName(int x)
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCaseWithRandomParameter([Random(1)] int x)
|
||||
{
|
||||
}
|
||||
|
||||
#if false // Test for issue #144
|
||||
[MyTestCase]
|
||||
public void TestCaseWithBadTestBuilder(string baz)
|
||||
{
|
||||
Assert.That(baz, Is.EqualTo("baz"));
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
|
||||
class MyTestCaseAttribute : Attribute, ITestBuilder
|
||||
{
|
||||
public IEnumerable<TestMethod> BuildFrom(IMethodInfo method, Test suite)
|
||||
{
|
||||
throw new InvalidOperationException("This is intentionally broken");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if NETCOREAPP1_1
|
||||
namespace NUnitCoreTestDemo.SetUpFixture
|
||||
#else
|
||||
namespace NUnitTestDemo.SetUpFixture
|
||||
#endif
|
||||
{
|
||||
[SetUpFixture]
|
||||
public class SetUpFixture
|
||||
{
|
||||
public static int SetUpCount;
|
||||
public static int TearDownCount;
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void BeforeTests()
|
||||
{
|
||||
Assert.That(SetUpCount, Is.EqualTo(0));
|
||||
SetUpCount++;
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public void AfterTests()
|
||||
{
|
||||
Assert.That(TearDownCount, Is.EqualTo(0));
|
||||
TearDownCount++;
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, ExpectPass]
|
||||
public class TestFixture1
|
||||
{
|
||||
[Test]
|
||||
public void Test1()
|
||||
{
|
||||
Assert.That(SetUpFixture.SetUpCount, Is.EqualTo(1));
|
||||
Assert.That(SetUpFixture.TearDownCount, Is.EqualTo(0));
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, ExpectPass]
|
||||
public class TestFixture2
|
||||
{
|
||||
[Test]
|
||||
public void Test2()
|
||||
{
|
||||
Assert.That(SetUpFixture.SetUpCount, Is.EqualTo(1));
|
||||
Assert.That(SetUpFixture.TearDownCount, Is.EqualTo(0));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if NETCOREAPP1_1
|
||||
namespace NUnitCoreTestDemo
|
||||
#else
|
||||
namespace NUnitTestDemo
|
||||
#endif
|
||||
{
|
||||
public class SimpleTests
|
||||
{
|
||||
[Test, ExpectPass]
|
||||
public void TestSucceeds()
|
||||
{
|
||||
Console.WriteLine("Simple test running");
|
||||
Assert.That(2 + 2, Is.EqualTo(4));
|
||||
}
|
||||
|
||||
[Test, ExpectPass]
|
||||
public void TestSucceeds_Message()
|
||||
{
|
||||
Assert.That(2 + 2, Is.EqualTo(4));
|
||||
Assert.Pass("Simple arithmetic!");
|
||||
}
|
||||
|
||||
[Test, ExpectFailure]
|
||||
public void TestFails()
|
||||
{
|
||||
Assert.That(2 + 2, Is.EqualTo(5));
|
||||
}
|
||||
|
||||
[Test, ExpectWarning]
|
||||
public void TestWarns()
|
||||
{
|
||||
Assert.Warn("This is a warning");
|
||||
}
|
||||
|
||||
[Test, ExpectWarning]
|
||||
public void TestWarnsThreeTimes()
|
||||
{
|
||||
Assert.Warn("Warning 1");
|
||||
Assert.Warn("Warning 2");
|
||||
Assert.Warn("Warning 3");
|
||||
}
|
||||
|
||||
[Test, ExpectFailure]
|
||||
public void TestWithThreeFailures()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.Fail("Failure 1");
|
||||
Assert.That(2 + 2, Is.EqualTo(5), "Failure 2");
|
||||
Assert.That(42, Is.GreaterThan(99), "Failure 3");
|
||||
});
|
||||
}
|
||||
|
||||
[Test, ExpectFailure]
|
||||
public void TestWithTwoFailuresAndAnError()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(2 + 2, Is.EqualTo(5));
|
||||
Assert.That(42, Is.GreaterThan(99));
|
||||
throw new Exception("Throwing after two failures");
|
||||
});
|
||||
}
|
||||
|
||||
[Test, ExpectFailure]
|
||||
public void TestWithFailureAndWarning()
|
||||
{
|
||||
Assert.Warn("WARNING!");
|
||||
Assert.Fail("FAILING!");
|
||||
}
|
||||
|
||||
[Test, ExpectFailure]
|
||||
public void TestWithTwoFailuresAndAWarning()
|
||||
{
|
||||
Warn.Unless(2 + 2 == 5, "Math is too hard!");
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(2 + 2, Is.EqualTo(5));
|
||||
Assert.That(42, Is.GreaterThan(99));
|
||||
});
|
||||
}
|
||||
|
||||
[Test, ExpectFailure]
|
||||
public void TestFails_StringEquality()
|
||||
{
|
||||
Assert.That("Hello" + "World" + "!", Is.EqualTo("Hello World!"));
|
||||
}
|
||||
|
||||
[Test, ExpectInconclusive]
|
||||
public void TestIsInconclusive()
|
||||
{
|
||||
Assert.Inconclusive("Testing");
|
||||
}
|
||||
|
||||
[Test, Ignore("Ignoring this test deliberately"), ExpectIgnore]
|
||||
public void TestIsIgnored_Attribute()
|
||||
{
|
||||
}
|
||||
|
||||
[Test, ExpectIgnore]
|
||||
public void TestIsIgnored_Assert()
|
||||
{
|
||||
Assert.Ignore("Ignoring this test deliberately");
|
||||
}
|
||||
|
||||
#if !NETCOREAPP1_1
|
||||
// Since we only run under .NET, test is always excluded
|
||||
[Test, ExpectSkip, Platform("Exclude=\"NET\"")]
|
||||
public void TestIsSkipped_Platform()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test, ExpectSkip, Explicit]
|
||||
public void TestIsExplicit()
|
||||
{
|
||||
}
|
||||
|
||||
[Test, ExpectError]
|
||||
public void TestThrowsException()
|
||||
{
|
||||
throw new Exception("Deliberate exception thrown");
|
||||
}
|
||||
|
||||
[Test, ExpectPass]
|
||||
[Property("Priority", "High")]
|
||||
public void TestWithProperty()
|
||||
{
|
||||
}
|
||||
|
||||
[Test, ExpectPass]
|
||||
[Property("Priority", "Low")]
|
||||
[Property("Action", "Ignore")]
|
||||
public void TestWithTwoProperties()
|
||||
{
|
||||
}
|
||||
|
||||
[Test, ExpectPass]
|
||||
[Category("Slow")]
|
||||
public void TestWithCategory()
|
||||
{
|
||||
}
|
||||
|
||||
[Test, ExpectPass]
|
||||
[Category("Slow")]
|
||||
[Category("Data")]
|
||||
public void TestWithTwoCategories()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using System.Diagnostics;
|
||||
|
||||
#if NETCOREAPP1_1
|
||||
namespace NUnitCoreTestDemo
|
||||
#else
|
||||
namespace NUnitTestDemo
|
||||
#endif
|
||||
{
|
||||
[ExpectPass]
|
||||
public class TextOutputTests
|
||||
{
|
||||
[Test]
|
||||
public void WriteToConsole()
|
||||
{
|
||||
Console.WriteLine("This is Console line 1");
|
||||
Console.WriteLine("This is Console line 2\nThis is Console line 3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WriteToError()
|
||||
{
|
||||
Console.Error.WriteLine("This is Error line 1");
|
||||
Console.Error.WriteLine("This is Error line 2\nThis is Error line 3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WriteToTestContext()
|
||||
{
|
||||
TestContext.WriteLine("Line 1 to TestContext");
|
||||
TestContext.WriteLine("Line 2 to TestContext\nLine 3 to TestContext");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WriteToTestContextOut()
|
||||
{
|
||||
TestContext.Out.WriteLine("Line 1 to TestContext.Out");
|
||||
TestContext.Out.WriteLine("Line 2 to TestContext.Out\nLine 3 to TestContext.Out");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WriteToTestContextError()
|
||||
{
|
||||
TestContext.Error.WriteLine("Line 1 to TestContext.Error");
|
||||
TestContext.Error.WriteLine("Line 2 to TestContext.Error\nLine 3 to TestContext.Error");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WriteToTestContextProgress()
|
||||
{
|
||||
TestContext.Progress.WriteLine("Line 1 to TestContext.Progress");
|
||||
TestContext.Progress.WriteLine("Line 2 to TestContext.Progress\nLine 3 to TestContext.Progress");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WriteToTrace()
|
||||
{
|
||||
Trace.Write("This is Trace line 1");
|
||||
Trace.Write("This is Trace line 2");
|
||||
Trace.Write("This is Trace line 3");
|
||||
}
|
||||
|
||||
[Test, Description("Displays various settings for verification")]
|
||||
public void DisplayTestSettings()
|
||||
{
|
||||
#if NETCOREAPP1_1
|
||||
Console.WriteLine("CurrentDirectory={0}", Directory.GetCurrentDirectory());
|
||||
Console.WriteLine("Location={0}", typeof(TextOutputTests).GetTypeInfo().Assembly.Location);
|
||||
#else
|
||||
Console.WriteLine("CurrentDirectory={0}", Environment.CurrentDirectory);
|
||||
Console.WriteLine("BasePath={0}", AppDomain.CurrentDomain.BaseDirectory);
|
||||
Console.WriteLine("PrivateBinPath={0}", AppDomain.CurrentDomain.SetupInformation.PrivateBinPath);
|
||||
#endif
|
||||
Console.WriteLine("WorkDirectory={0}", TestContext.CurrentContext.WorkDirectory);
|
||||
Console.WriteLine("DefaultTimeout={0}", NUnit.Framework.Internal.TestExecutionContext.CurrentContext.TestCaseTimeout);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DisplayTestParameters()
|
||||
{
|
||||
if (TestContext.Parameters.Count == 0)
|
||||
Console.WriteLine("No TestParameters were passed");
|
||||
else
|
||||
foreach (var name in TestContext.Parameters.Names)
|
||||
Console.WriteLine("Parameter: {0} = {1}", name, TestContext.Parameters.Get(name));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
#if NETCOREAPP1_1
|
||||
namespace NUnitCoreTestDemo
|
||||
#else
|
||||
namespace NUnitTestDemo
|
||||
#endif
|
||||
{
|
||||
public class Theories
|
||||
{
|
||||
[Datapoints]
|
||||
int[] data = new int[] { 0, 1, 42 };
|
||||
|
||||
[Theory, ExpectPass]
|
||||
public void Theory_AllCasesSucceed(int a, int b)
|
||||
{
|
||||
Assert.That(a + b, Is.EqualTo(b + a));
|
||||
}
|
||||
|
||||
[Theory, ExpectMixed]
|
||||
public void Theory_SomeCasesAreInconclusive(int a, int b)
|
||||
{
|
||||
Assume.That(b != 0);
|
||||
}
|
||||
|
||||
[Theory, ExpectMixed]
|
||||
public void Theory_SomeCasesFail(int a, int b)
|
||||
{
|
||||
Assert.That(b != 0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
Imports System.Threading
|
||||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo
|
||||
|
||||
<Apartment(ApartmentState.STA)>
|
||||
Public Class FixtureWithApartmentAttributeOnClass
|
||||
|
||||
<Test>
|
||||
Public Sub TestMethodInSTAFixture()
|
||||
Assert.That(Thread.CurrentThread.GetApartmentState(), Iz.EqualTo(ApartmentState.STA))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class FixtureWithApartmentAttributeOnMethod
|
||||
|
||||
<Test, Apartment(ApartmentState.STA)>
|
||||
Public Sub TestMethodInSTA()
|
||||
Assert.That(Thread.CurrentThread.GetApartmentState(), Iz.EqualTo(ApartmentState.STA))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,69 @@
|
|||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo
|
||||
|
||||
Public Class AsyncTests
|
||||
|
||||
<Test, ExpectError>
|
||||
Public Async Sub AsyncVoidTestIsInvalid()
|
||||
Dim result = Await ReturnOne()
|
||||
|
||||
Assert.AreEqual(1, result)
|
||||
End Sub
|
||||
|
||||
<Test, ExpectPass>
|
||||
Public Async Function AsyncTaskTestSucceeds() As Task
|
||||
Dim result = Await ReturnOne()
|
||||
|
||||
Assert.AreEqual(1, result)
|
||||
End Function
|
||||
|
||||
<Test, ExpectFailure>
|
||||
Public Async Function AsyncTaskTestFails() As Task
|
||||
Dim result = Await ReturnOne()
|
||||
|
||||
Assert.AreEqual(2, result)
|
||||
End Function
|
||||
|
||||
<Test, ExpectError>
|
||||
Public Async Function AsyncTaskTestThrowsException() As Task
|
||||
Await ThrowException()
|
||||
|
||||
Assert.Fail("Should never get here")
|
||||
End Function
|
||||
|
||||
<TestCase(ExpectedResult:=1), ExpectPass>
|
||||
Public Async Function AsyncTaskWithResultSucceeds() As Task(Of Integer)
|
||||
Return Await ReturnOne()
|
||||
End Function
|
||||
|
||||
<TestCase(ExpectedResult:=2), ExpectFailure>
|
||||
Public Async Function AsyncTaskWithResultFails() As Task(Of Integer)
|
||||
Return Await ReturnOne()
|
||||
End Function
|
||||
|
||||
<TestCase(ExpectedResult:=0), ExpectError>
|
||||
Public Async Function AsyncTaskWithResultThrowsException() As Task(Of Integer)
|
||||
Return Await ThrowException()
|
||||
End Function
|
||||
|
||||
Private Shared Function ReturnOne() As Task(Of Integer)
|
||||
Return Task.Run(
|
||||
Function()
|
||||
Return 1
|
||||
End Function
|
||||
)
|
||||
End Function
|
||||
|
||||
Private Shared Function ThrowException() As Task(Of Integer)
|
||||
Return Task.Run(
|
||||
Function()
|
||||
Throw New InvalidOperationException()
|
||||
Return 1
|
||||
End Function
|
||||
)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,22 @@
|
|||
Imports System.Configuration
|
||||
Imports System.IO
|
||||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo
|
||||
|
||||
<ExpectPass>
|
||||
Public Class ConfigFileTests
|
||||
<Test>
|
||||
Public Shared Sub ProperConfigFileIsUsed()
|
||||
Dim expectedPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "VbTestDemo.dll.config")
|
||||
Assert.That(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, Iz.EqualTo(expectedPath))
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Shared Sub CanReadConfigFile()
|
||||
Assert.That(ConfigurationManager.AppSettings.Get("test.setting"), Iz.EqualTo("54321"))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,78 @@
|
|||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo
|
||||
|
||||
Public Class ExpectPassAttribute
|
||||
Inherits PropertyAttribute
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New("Expect", "Pass")
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
Public Class ExpectFailureAttribute
|
||||
Inherits PropertyAttribute
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New("Expect", "Failure")
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ExpectWarningAttribute
|
||||
Inherits PropertyAttribute
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New("Expect", "Warning")
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ExpectIgnoreAttribute
|
||||
Inherits PropertyAttribute
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New("Expect", "Ignore")
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ExpectSkipAttribute
|
||||
Inherits PropertyAttribute
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New("Expect", "Skipped")
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ExpectErrorAttribute
|
||||
Inherits PropertyAttribute
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New("Expect", "Error")
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ExpectInconclusiveAttribute
|
||||
Inherits PropertyAttribute
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New("Expect", "Inconclusive")
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class ExpectMixedAttribute
|
||||
Inherits PropertyAttribute
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New("Expect", "Mixed")
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,37 @@
|
|||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo
|
||||
|
||||
<TestFixture(GetType(Integer))>
|
||||
Public Class GenericTests(Of T)
|
||||
|
||||
<Test, ExpectPass>
|
||||
Public Sub TestIt()
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
<ExpectPass>
|
||||
<TestFixture(GetType(ArrayList))>
|
||||
<TestFixture(GetType(List(Of Integer)))>
|
||||
Public Class GenericTests_IList(Of TList As {IList, New})
|
||||
|
||||
Dim list As IList
|
||||
|
||||
<SetUp>
|
||||
Public Sub CreateList()
|
||||
list = New TList()
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Sub CanAddToList()
|
||||
list.Add(1)
|
||||
list.Add(2)
|
||||
list.Add(3)
|
||||
Assert.AreEqual(3, list.Count)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,19 @@
|
|||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo
|
||||
|
||||
Public MustInherit Class InheritedTestBaseClass
|
||||
|
||||
<Test>
|
||||
Public Sub TestInBaseClass()
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Public Class InheritedTestDerivedClass
|
||||
Inherits InheritedTestBaseClass
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,39 @@
|
|||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo
|
||||
|
||||
<TestFixture, ExpectPass>
|
||||
Public Class OneTimeSetUpTests
|
||||
|
||||
Dim SetUpCount As Integer
|
||||
Dim TearDownCount As Integer
|
||||
|
||||
<OneTimeSetUp>
|
||||
Public Sub BeforeTests()
|
||||
Assert.That(SetUpCount, Iz.EqualTo(0))
|
||||
Assert.That(TearDownCount, Iz.EqualTo(0))
|
||||
SetUpCount = SetUpCount + 1
|
||||
End Sub
|
||||
|
||||
<OneTimeTearDown>
|
||||
Public Sub AfterTests()
|
||||
Assert.That(SetUpCount, Iz.EqualTo(1), "Unexpected error")
|
||||
Assert.That(TearDownCount, Iz.EqualTo(0))
|
||||
TearDownCount = TearDownCount + 1
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Sub Test1()
|
||||
Assert.That(SetUpCount, Iz.EqualTo(1))
|
||||
Assert.That(TearDownCount, Iz.EqualTo(0))
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Sub Test2()
|
||||
Assert.That(SetUpCount, Iz.EqualTo(1))
|
||||
Assert.That(TearDownCount, Iz.EqualTo(0))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,110 @@
|
|||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo
|
||||
|
||||
Public Class ParameterizedTests
|
||||
|
||||
<ExpectPass>
|
||||
<TestCase(2, 2, 4)>
|
||||
<TestCase(0, 5, 5)>
|
||||
<TestCase(31, 11, 42)>
|
||||
Public Sub TestCaseSucceeds(a As Integer, b As Integer, sum As Integer)
|
||||
Assert.That(a + b, Iz.EqualTo(sum))
|
||||
End Sub
|
||||
|
||||
<ExpectPass>
|
||||
<TestCase(2, 2, ExpectedResult:=4)>
|
||||
<TestCase(0, 5, ExpectedResult:=5)>
|
||||
<TestCase(31, 11, ExpectedResult:=42)>
|
||||
Public Function TestCaseSucceeds_Result(a As Integer, b As Integer) As Integer
|
||||
Return a + b
|
||||
End Function
|
||||
|
||||
<ExpectFailure>
|
||||
<TestCase(31, 11, 99)>
|
||||
Public Sub TestCaseFails(a As Integer, b As Integer, sum As Integer)
|
||||
Assert.That(a + b, Iz.EqualTo(sum))
|
||||
End Sub
|
||||
|
||||
<ExpectWarning>
|
||||
<TestCase(31, 11, 99)>
|
||||
Public Sub TestCaseWarns(a As Integer, b As Integer, sum As Integer)
|
||||
Warn.Unless(a + b, Iz.EqualTo(sum))
|
||||
End Sub
|
||||
|
||||
<ExpectWarning>
|
||||
<TestCase(31, 11, 99)>
|
||||
Public Sub TestCaseWarnsThreeTimes(a As Integer, b As Integer, answer As Integer)
|
||||
Warn.Unless(a + b, Iz.EqualTo(answer), "Bad sum")
|
||||
Warn.Unless(a - b, Iz.EqualTo(answer), "Bad difference")
|
||||
Warn.Unless(a * b, Iz.EqualTo(answer), "Bad product")
|
||||
End Sub
|
||||
|
||||
<TestCase(31, 11, ExpectedResult:=99), ExpectFailure>
|
||||
Public Function TestCaseFails_Result(a As Integer, b As Integer) As Integer
|
||||
Return a + b
|
||||
End Function
|
||||
|
||||
<TestCase(31, 11), ExpectInconclusive>
|
||||
Public Sub TestCaseIsInconclusive(a As Integer, b As Integer)
|
||||
Assert.Inconclusive("Inconclusive test case")
|
||||
End Sub
|
||||
|
||||
<Ignore("Ignored test"), ExpectIgnore>
|
||||
<TestCase(31, 11)>
|
||||
Public Sub TestCaseIsIgnored_Attribute(a As Integer, b As Integer)
|
||||
|
||||
End Sub
|
||||
|
||||
<TestCase(31, 11, Ignore:="Ignoring this"), ExpectIgnore>
|
||||
Public Sub TestCaseIsIgnored_Property(a As Integer, b As Integer)
|
||||
|
||||
End Sub
|
||||
|
||||
<TestCase(31, 11), ExpectIgnore>
|
||||
Public Sub TestCaseIsIgnored_Assert(a As Integer, b As Integer)
|
||||
Assert.Ignore("Ignoring this test case")
|
||||
End Sub
|
||||
|
||||
#If Not NETCOREAPP1_1 Then
|
||||
<TestCase(31, 11, ExcludePlatform:="NET"), ExpectSkip>
|
||||
Public Sub TestCaseIsSkipped_Property(a As Integer, b As Integer)
|
||||
|
||||
End Sub
|
||||
|
||||
<Platform(Exclude:="NET"), ExpectSkip>
|
||||
<TestCase(31, 11)>
|
||||
Public Sub TestCaseIsSkipped_Attribute(a As Integer, b As Integer)
|
||||
|
||||
End Sub
|
||||
#End If
|
||||
|
||||
<Explicit, ExpectSkip>
|
||||
<TestCase(31, 11)>
|
||||
Public Sub TestCaseIsExplicit(a As Integer, b As Integer)
|
||||
|
||||
End Sub
|
||||
|
||||
<TestCase(31, 11), ExpectError>
|
||||
Public Sub TestCaseThrowsException(a As Integer, b As Integer)
|
||||
Throw New Exception("Exception from test case")
|
||||
End Sub
|
||||
|
||||
<TestCase(42, TestName:="AlternateTestName"), ExpectPass>
|
||||
Public Sub TestCaseWithAlternateName(x As Integer)
|
||||
|
||||
End Sub
|
||||
|
||||
<TestCase(42, TestName:="NameWithSpecialChar->Here")>
|
||||
Public Sub TestCaseWithSpecialCharInName(x As Integer)
|
||||
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Sub TestCaseWithRandomParameter(<Random(1)> x As Integer)
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,46 @@
|
|||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo.SetUpFixture
|
||||
|
||||
<SetUpFixture>
|
||||
Public Class SetUpFixture
|
||||
Public Shared SetUpCount As Integer
|
||||
Public Shared TearDownCount As Integer
|
||||
|
||||
<OneTimeSetUp>
|
||||
Public Sub BeforeTests()
|
||||
Assert.That(SetUpCount, Iz.EqualTo(0))
|
||||
SetUpCount = SetUpCount + 1
|
||||
End Sub
|
||||
|
||||
<OneTimeTearDown>
|
||||
Public Sub AfterTests()
|
||||
Assert.That(TearDownCount, Iz.EqualTo(0))
|
||||
TearDownCount = TearDownCount + 1
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
<TestFixture, ExpectPass>
|
||||
Public Class TestFixture1
|
||||
|
||||
<Test>
|
||||
Public Sub Test1()
|
||||
Assert.That(SetUpFixture.SetUpCount, Iz.EqualTo(1))
|
||||
Assert.That(SetUpFixture.TearDownCount, Iz.EqualTo(0))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
<TestFixture, ExpectPass>
|
||||
Public Class TestFixture2
|
||||
|
||||
<Test>
|
||||
Public Sub Test2()
|
||||
Assert.That(SetUpFixture.SetUpCount, Iz.EqualTo(1))
|
||||
Assert.That(SetUpFixture.TearDownCount, Iz.EqualTo(0))
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,142 @@
|
|||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo
|
||||
|
||||
Public Class SimpleTests
|
||||
|
||||
<Test, ExpectPass>
|
||||
Public Sub TestSucceeds()
|
||||
Console.WriteLine("Simple test running")
|
||||
Assert.That(2 + 2, Iz.EqualTo(4))
|
||||
End Sub
|
||||
|
||||
<Test, ExpectPass>
|
||||
Public Sub TestSucceeds_Message()
|
||||
Assert.That(2 + 2, Iz.EqualTo(4))
|
||||
Assert.Pass("Simple arithmetic!")
|
||||
End Sub
|
||||
|
||||
<Test, ExpectFailure>
|
||||
Public Sub TestFails()
|
||||
Assert.That(2 + 2, Iz.EqualTo(5))
|
||||
End Sub
|
||||
|
||||
<Test, ExpectWarning>
|
||||
Public Sub TestWarns()
|
||||
Assert.Warn("This is a warning")
|
||||
End Sub
|
||||
|
||||
<Test, ExpectWarning>
|
||||
Public Sub TestWarnsThreeTimes()
|
||||
Assert.Warn("Warning 1")
|
||||
Assert.Warn("Warning 2")
|
||||
Assert.Warn("Warning 3")
|
||||
End Sub
|
||||
|
||||
<Test, ExpectFailure>
|
||||
Public Sub TestWithThreeFailures()
|
||||
Assert.Multiple(
|
||||
Sub()
|
||||
Assert.Fail("Failure 1")
|
||||
Assert.That(2 + 2, Iz.EqualTo(5), "Failure 2")
|
||||
Assert.That(42, Iz.GreaterThan(99), "Failure 3")
|
||||
End Sub
|
||||
)
|
||||
End Sub
|
||||
|
||||
<Test, ExpectFailure>
|
||||
Public Sub TestWithTwoFailuresAndAnError()
|
||||
Assert.Multiple(
|
||||
Sub()
|
||||
Assert.That(2 + 2, Iz.EqualTo(5))
|
||||
Assert.That(42, Iz.GreaterThan(99))
|
||||
Throw New Exception("Throwing after two failures")
|
||||
End Sub
|
||||
)
|
||||
End Sub
|
||||
|
||||
<Test, ExpectFailure>
|
||||
Public Sub TestWithFailureAndWarning()
|
||||
Assert.Warn("WARNING!")
|
||||
Assert.Fail("FAILING!")
|
||||
End Sub
|
||||
|
||||
<Test, ExpectFailure>
|
||||
Public Sub TestWithTwoFailuresAndAWarning()
|
||||
Warn.Unless(2 + 2 = 5, "Math is too hard!")
|
||||
|
||||
Assert.Multiple(
|
||||
Sub()
|
||||
Assert.That(2 + 2, Iz.EqualTo(5))
|
||||
Assert.That(42, Iz.GreaterThan(99))
|
||||
End Sub
|
||||
)
|
||||
End Sub
|
||||
|
||||
<Test, ExpectFailure>
|
||||
Public Sub TestFails_StringEquality()
|
||||
Assert.That("Hello" + "World" + "!", Iz.EqualTo("Hello World!"))
|
||||
End Sub
|
||||
|
||||
<Test, ExpectInconclusive>
|
||||
Public Sub TestIsInconclusive()
|
||||
Assert.Inconclusive("Testing")
|
||||
End Sub
|
||||
|
||||
<Test, Ignore("Ignoring this test deliberately"), ExpectIgnore>
|
||||
Public Sub TestIsIgnored_Attribute()
|
||||
|
||||
End Sub
|
||||
|
||||
<Test, ExpectIgnore>
|
||||
Public Sub TestIsIgnored_Assert()
|
||||
Assert.Ignore("Ignoring this test deliberately")
|
||||
End Sub
|
||||
|
||||
#If Not NETCOREAPP1_1 Then
|
||||
'Since we only run under .NET, test Is always excluded
|
||||
<Test, ExpectSkip, Platform(Exclude:="NET")>
|
||||
Public Sub TestIsSkipped_Platform()
|
||||
|
||||
End Sub
|
||||
#End If
|
||||
|
||||
<Test, ExpectSkip, Explicit>
|
||||
Public Sub TestIsExplicit()
|
||||
|
||||
End Sub
|
||||
|
||||
<Test, ExpectError>
|
||||
Public Sub TestThrowsException()
|
||||
Throw New Exception("Deliberate exception thrown")
|
||||
End Sub
|
||||
|
||||
<Test, ExpectPass>
|
||||
<PropertyAttribute("Priority", "High")>
|
||||
Public Sub TestWithProperty()
|
||||
|
||||
End Sub
|
||||
|
||||
<Test, ExpectPass>
|
||||
<PropertyAttribute("Priority", "Low")>
|
||||
<PropertyAttribute("Action", "Ignore")>
|
||||
Public Sub TestWithTwoProperties()
|
||||
|
||||
End Sub
|
||||
|
||||
<Test, ExpectPass>
|
||||
<Category("Slow")>
|
||||
Public Sub TestWithCategory()
|
||||
|
||||
End Sub
|
||||
|
||||
<Test, ExpectPass>
|
||||
<Category("Slow")>
|
||||
<Category("Data")>
|
||||
Public Sub TestWithTwoCategories()
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,78 @@
|
|||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo
|
||||
|
||||
<ExpectPass>
|
||||
Public Class TextOutputTests
|
||||
|
||||
<Test>
|
||||
Public Sub WriteToConsole()
|
||||
Console.WriteLine("This is Console line 1")
|
||||
Console.WriteLine("This is Console line 2\nThis is Console line 3")
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Sub WriteToError()
|
||||
Console.Error.WriteLine("This is Error line 1")
|
||||
Console.Error.WriteLine("This is Error line 2\nThis is Error line 3")
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Sub WriteToTestContext()
|
||||
TestContext.WriteLine("Line 1 to TestContext")
|
||||
TestContext.WriteLine("Line 2 to TestContext\nLine 3 to TestContext")
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Sub WriteToTestContextOut()
|
||||
TestContext.Out.WriteLine("Line 1 to TestContext.Out")
|
||||
TestContext.Out.WriteLine("Line 2 to TestContext.Out\nLine 3 to TestContext.Out")
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Sub WriteToTestContextError()
|
||||
TestContext.Error.WriteLine("Line 1 to TestContext.Error")
|
||||
TestContext.Error.WriteLine("Line 2 to TestContext.Error\nLine 3 to TestContext.Error")
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Sub WriteToTestContextProgress()
|
||||
TestContext.Progress.WriteLine("Line 1 to TestContext.Progress")
|
||||
TestContext.Progress.WriteLine("Line 2 to TestContext.Progress\nLine 3 to TestContext.Progress")
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Sub WriteToTrace()
|
||||
Trace.Write("This is Trace line 1")
|
||||
Trace.Write("This is Trace line 2")
|
||||
Trace.Write("This is Trace line 3")
|
||||
End Sub
|
||||
|
||||
<Test, Description("Displays various settings for verification")>
|
||||
Public Sub DisplayTestSettings()
|
||||
#If NETCOREAPP1_1 Then
|
||||
Console.WriteLine("CurrentDirectory={0}", Directory.GetCurrentDirectory())
|
||||
Console.WriteLine("Location={0}", typeof(TextOutputTests).GetTypeInfo().Assembly.Location)
|
||||
#Else
|
||||
Console.WriteLine("CurrentDirectory={0}", Environment.CurrentDirectory)
|
||||
Console.WriteLine("BasePath={0}", AppDomain.CurrentDomain.BaseDirectory)
|
||||
Console.WriteLine("PrivateBinPath={0}", AppDomain.CurrentDomain.SetupInformation.PrivateBinPath)
|
||||
#End If
|
||||
Console.WriteLine("WorkDirectory={0}", TestContext.CurrentContext.WorkDirectory)
|
||||
Console.WriteLine("DefaultTimeout={0}", NUnit.Framework.Internal.TestExecutionContext.CurrentContext.TestCaseTimeout)
|
||||
End Sub
|
||||
|
||||
<Test>
|
||||
Public Sub DisplayTestParameters()
|
||||
If (TestContext.Parameters.Count = 0) Then
|
||||
Console.WriteLine("No TestParameters were passed")
|
||||
Else
|
||||
For Each name As String In TestContext.Parameters.Names
|
||||
Console.WriteLine("Parameter: {0} = {1}", name, TestContext.Parameters.Get(name))
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
|
@ -0,0 +1,27 @@
|
|||
Imports NUnit.Framework
|
||||
|
||||
Namespace NUnitTestDemo
|
||||
|
||||
Public Class Theories
|
||||
|
||||
<Datapoints>
|
||||
Private data As Integer() = {0, 1, 42}
|
||||
|
||||
<Theory, ExpectPass>
|
||||
Public Sub Theory_AllCasesSucceed(a As Integer, b As Integer)
|
||||
Assert.That(a + b, Iz.EqualTo(b + a))
|
||||
End Sub
|
||||
|
||||
<Theory, ExpectMixed>
|
||||
Public Sub Theory_SomeCasesAreInconclusive(a As Integer, b As Integer)
|
||||
Assume.That(b <> 0)
|
||||
End Sub
|
||||
|
||||
<Theory, ExpectMixed>
|
||||
Public Sub Theory_SomeCasesFail(a As Integer, b As Integer)
|
||||
Assert.That(b <> 0)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
Загрузка…
Ссылка в новой задаче