The simplest solution is to visit test.winehq.org and download the latest version of winetest at the bottom of the page. This executable contains all the Wine conformance tests, runs them and reports the results.
You can also get the older versions from Paul Millar's website.
If you are using Visual Studio 6, make sure you have the processor pack. The processor pack fixes error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64. However note that the processor pack is incompatible with Visual Studio 6.0 Standard Edition, and with the Visual Studio 6 Service Pack 6. If you are using Visual Studio 7 or greater you don't need it. In either case it is recommended to use the most recent compatible Visual Studio service pack. If are using Visual Studio Express and you need specific libraries like ntdll.lib that don't ship with Visual Studio Express, you will need the Windows Driver Development Kit (DDK) which is part of the Windows Developer Kit.
get the Wine sources
Run msvcmaker to generate Visual C++ project files for the tests. msvcmaker is a perl script so you may be able to run it on Windows.
$ ./tools/winapi/msvcmaker --no-wine
If the previous steps were done on your Linux development machine, make the Wine sources accessible to the Windows machine on which you are going to compile them. Typically you would do this using Samba but copying them altogether would work too.
On the Windows machine, open the winetest.dsw workspace. This will load each test's project. For each test there are two configurations: one compiles the test with the Wine headers, and the other uses the Microsoft headers.
If you choose the "Win32 MSVC Headers" configuration, most of the tests will not compile with the regular Visual Studio headers. So to use this configuration, download and install a recent Platform SDK as well as the latest DirectX SDK. Then, configure Visual Studio to use these SDK headers and libraries. Alternately you could go to the Project->Settings... menu and modify the settings appropriately, but you would then have to redo this whenever you rerun msvcmaker.
Open the Build->Batch build... menu and select the tests and build configurations you want to build. Then click on Build.
To run a specific test from Visual C++, go to Project->Settings.... There select that test's project and build configuration and go to the Debug tab. There type the name of the specific test to run (e.g. thread) in the Program arguments field. Validate your change by clicking on Ok and start the test by clicking the red exclamation mark (or hitting F5 or any other usual method).
You can also run the tests from the command line. You will find them in either Output\Win32_Wine_Headers or Output\Win32_MSVC_Headers depending on the build method. So to run the kernel path tests you would do:
C:\> cd dlls\kernel\tests\Output\Win32_MSVC_Headers C:\wine\dlls\kernel\tests\Output\Win32_MSVC_Headers> kernel32_test path
Wine build system already has support for building tests with a MinGW-w64 cross-compiler. See the section above called "Setup of the MinGW-w64 cross-compiling environment" for instructions on how to set things up. When you have a MinGW-w64 environment installed all you need to do is rerun configure and it should detect the MinGW-w64 compiler and tools. Then run make crosstest to start building the tests.
Sometimes it's nice to be able to build a new unit test on Windows without Wine, and without buying Microsoft Visual C++. Here's the simplest way to do that on a Windows system:
Make a wine directory underneath your work directory, and copy the file wine/test.h from the Wine source tree there (you can download this file from the latest revision at http://source.winehq.org/git/?p=wine.git;a=blob_plain;f=include/wine/test.h).
Copy some existing test from the Wine source tree, or create your test program (say, mytest.c) using Notepad, being sure to begin it with #include <wine/test.h> following the usual Wine test style.
Finally, in a command prompt window, compile the test with the command
C:\your\work\dir> cl -I. -DSTANDALONE -D_X86_ mytest.c
Once that's working, try running the program under Wine without recompiling it. See? No Wine source required at all, save for that one header, wine/test.h.
If you want to use the Microsoft C++ Toolkit under Wine, see CL Howto for some tips on making it easy to use it from the Linux command line.