You are unconditionally running the tests after the build. If the last executed command returns a zero exit code then it will overwrite any non-zero exit code from the previous commands.
So you need to check the exit code (ERRORLEVEL in Windows batch) between each command and exit if non-zero. Alternatively, if you want to run the tests even if the build fails, save the exit code and exit with it at the end.
To exit immediately:
@ECHO OFF
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\msbuild CaptainHook.sln /m /nr:false /p:Platform="Any CPU" /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal
IF ERRORLEVEL 1 GOTO :EOF
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\msbuild Tests.sln /m /nr:false /p:Platform="Any CPU" /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal
IF ERRORLEVEL 1 GOTO :EOF
"%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe" /testcontainer:%CD%\src\UnitTests\bin\Debug\UnitTests.dll"
IF ERRORLEVEL 1 GOTO :EOF
(the extra line at the end allows adding more commands easily).
To execute all and exit with highest errorlevel:
@ECHO OFF
SETLOCAL
SET EXITCODE=0
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\msbuild CaptainHook.sln /m /nr:false /p:Platform="Any CPU" /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal
IF %ERRORLEVEL% GTR %EXITCODE% SET EXITCODE=%ERRORLEVEL%
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\msbuild Tests.sln /m /nr:false /p:Platform="Any CPU" /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal
IF %ERRORLEVEL% GTR %EXITCODE% SET EXITCODE=%ERRORLEVEL%
"%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe" /testcontainer:%CD%\src\UnitTests\bin\Debug\UnitTests.dll"
IF %ERRORLEVEL% GTR %EXITCODE% SET EXITCODE=%ERRORLEVEL%
EXIT /B %EXITCODE%