-
September 5th, 2012, 03:52 AM
#1
Spacing problem of namespaces in C++ unit testing
Code:
Code:
#include "stdafx.h"
using namespace System;
using namespace System::Text;
using namespace System::Collections::Generic;
using namespace Microsoft::VisualStudio::TestTools::UnitTesting;
namespace PerfectSimTest1
{
[TestClass]
public ref class CGameApplicationTest
{
private:
TestContext^ testContextInstance;
public:
/// <summary>
///取得或設定提供目前測試回合
///的相關資訊與功能的測試內容。
///</summary>
property Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ TestContext
{
Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ get()
{
return testContextInstance;
}
System::Void set(Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ value)
{
testContextInstance = value;
}
};
#pragma region Additional test attributes
//
//您可以在撰寫測試時,使用下列的其他屬性:
//
//在執行類別中的第一項測試之前,先使用 ClassInitialize 執行程式碼
//[ClassInitialize()]
//static void MyClassInitialize(TestContext^ testContext) {};
//
//在執行類別中的所有測試之後,使用 ClassCleanup 執行程式碼
//[ClassCleanup()]
//static void MyClassCleanup() {};
//
//在執行每一項測試之前,先使用 TestInitialize 執行程式碼
//[TestInitialize()]
//void MyTestInitialize() {};
//
//在執行每一項測試之後,使用 TestCleanup 執行程式碼
//[TestCleanup()]
//void MyTestCleanup() {};
//
#pragma endregion
[TestMethod]
void RunTest()
{
CGameApplication;
CGameApplication^ oCache = gcnew CGameApplication();
oCache->Run();
//
// TODO: 在此加入測試邏輯
//
};
};
}
The error being is CGameApplication can't be recognized, undefined or something.
There is a space in between the project name such as "Simulation V2.0"
When I do,
using namespace Simulation V2.0 or using namespace "Simulation V2.0", the compiler complains.
I have made a reference in the .NET section of the test project to no avail
Please help
Thanks
Jack
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|