Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
CardDAV2: Fixed FakeConnectionObject unit tests
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 13 Feb 2017 22:06:05 +0000 (22:06 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 13 Feb 2017 22:06:05 +0000 (22:06 +0000)
source/tests/classes/FakeConnectionObject.cpp
source/tests/classes/FakeConnectionObject.h
source/tests/xestiaab_carddav.cpp

index 348956c..4a348a5 100644 (file)
 
 #include "FakeConnectionObject.h"
 
+FakeConnectionObject::FakeConnectionObject(std::string ServerAddress, int ServerPort, 
+       std::string ServerUser, std::string ServerPass, bool ServerSSL){
+       
+       this->ServerAddress = ServerAddress;
+       this->ServerPort = ServerPort;
+       this->ServerUser = ServerUser;
+       this->ServerPass = ServerPass;
+       this->ServerSSL = ServerSSL;
+               
+}
+
+FakeConnectionObject::FakeConnectionObject(std::string ServerAddress, int ServerPort, 
+       std::string ServerUser, std::string ServerPass, bool ServerSSL, 
+       std::string ServerPrefix, std::string ServerAccount){
+       
+       this->ServerAddress = ServerAddress;
+       this->ServerPort = ServerPort;
+       this->ServerUser = ServerUser;
+       this->ServerPass = ServerPass;
+       this->ServerSSL = ServerSSL;
+       this->ServerPrefix = ServerPrefix;
+       this->ServerAccount = ServerAccount;
+               
+}
+
+FakeConnectionObject::~FakeConnectionObject(){
+       
+}
+
 COConnectResult FakeConnectionObject::Connect(bool DoAuthentication){
        
        COConnectResult ConnectResult = ResultStatus;
@@ -154,7 +183,7 @@ bool FakeConnectionObject::GetServerSSL(){
 }
 
 bool FakeConnectionObject::GetTestMode(){
-       return TestMode;
+       return ResultTestMode;
 }
 
 bool FakeConnectionObject::CanDoProcessing(){
index 9a214a7..41f5ce4 100644 (file)
@@ -25,7 +25,14 @@ class FakeConnectionObject : public ConnectionObject {
        
        public:
        
-               using ConnectionObject::ConnectionObject;
+               //using ConnectionObject::ConnectionObject;
+       
+               FakeConnectionObject(std::string ServerAddress, int ServerPort, std::string ServerUser, std::string ServerPass, bool ServerSSL);
+               FakeConnectionObject(std::string ServerAddress, int ServerPort, std::string ServerUser, std::string ServerPass, bool ServerSSL, std::string ServerPrefix, std::string ServerAccount);
+
+               // Destructor.
+       
+               ~FakeConnectionObject();
        
                // Functions for fake connection object.
        
@@ -72,14 +79,15 @@ class FakeConnectionObject : public ConnectionObject {
                bool ResultTaskCompleted = false;
                CORequestResult TestRequestResult;
                COContactList TestContactList;
-               std::string TestEntityTag;
-               int TestSessionCode;
-               int TestResultCode;
-               std::string TestResultMessage;
+               std::string TestEntityTag = "";
+               int TestSessionCode = 0;
+               int TestResultCode = 0;
+               std::string TestResultMessage = "";
+               bool ResultTestMode = false;
        
        protected:
        private:
        
 };
 
-#endif
\ No newline at end of file
+#endif
index e205c9b..a4fa5ec 100644 (file)
@@ -41,6 +41,10 @@ TEST(CardDAV, Use_Fake_To_Setup_And_Check_Connection_Settings_With_TestMode_True
        FakeConnectionObject FakeConnection2(ServerAddress2, 8800, ServerUser2, ServerPass2, true);
        FakeConnectionObject FakeConnection3(ServerAddress3, 8008, ServerUser3, ServerPass3, false);
        
+       FakeConnection1.ResultTestMode = true;
+       FakeConnection2.ResultTestMode = true;
+       FakeConnection3.ResultTestMode = true;
+       
        EXPECT_EQ("gibberish.invalid", FakeConnection1.GetServerAddress());
        EXPECT_EQ(8080, FakeConnection1.GetServerPort());
        EXPECT_EQ("user", FakeConnection1.GetServerUser());
@@ -88,6 +92,10 @@ TEST(CardDAV, Use_Fake_To_Setup_And_Check_Connection_Settings_With_TestMode_Fals
        FakeConnectionObject FakeConnection2(ServerAddress2, 8800, ServerUser2, ServerPass2, true, "/prefix2", "Account2");
        FakeConnectionObject FakeConnection3(ServerAddress3, 8008, ServerUser3, ServerPass3, false, "/prefix3", "Account3");
        
+       FakeConnection1.ResultTestMode = false;
+       FakeConnection2.ResultTestMode = false;
+       FakeConnection3.ResultTestMode = false;
+       
        EXPECT_EQ("gibberish.invalid", FakeConnection1.GetServerAddress());
        EXPECT_EQ(8080, FakeConnection1.GetServerPort());
        EXPECT_EQ("user", FakeConnection1.GetServerUser());
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy