Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added unit tests for ConnectionObject interface and FakeConnectionObject class
[xestiaab/.git] / source / tests / classes / FakeConnectionObject.cpp
1 // FakeConnectionObject.cpp - FakeConnectionObject class
2 //
3 // (c) 2012-2015 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "FakeConnectionObject.h"
21 COConnectResult FakeConnectionObject::Connect(){
22         
23         COConnectResult ConnectResult = ResultStatus;
24         AuthPassed = ResultAuthPassed;
25         CanProcess = ResultCanProcess;
26         SSLStatus = ResultSSLStatus;
27         SSLVerified = ResultSSLVerified;
28         ValidResponse = ResultValidResponse;
29         SSLSelfSigned = ResultSelfSigned;
30         ServerPrefix = ResultServerPrefix;
31         return ConnectResult;
32 }
34 bool FakeConnectionObject::IsTaskCompleted(){
35         TaskCompleted = ResultTaskCompleted;
36         return TaskCompleted;
37 }
39 std::string FakeConnectionObject::GetDefaultPrefix(){
40         return ServerPrefix;
41 }
43 COServerResponse FakeConnectionObject::AddContact(std::string Location, std::string Data){
44         
45         COServerResponse AddContactResult;
46         
47         AddContactResult.RequestResult = TestRequestResult;
48         AddContactResult.EntityTag = TestEntityTag;
49         AddContactResult.SessionCode = TestSessionCode;
50         AddContactResult.ResultCode = TestResultCode;
51         AddContactResult.ResultMessage = TestResultMessage;
52         
53         return AddContactResult;
54         
55 }
57 COServerResponse FakeConnectionObject::EditContact(std::string Location, std::string Data){
58         
59         COServerResponse EditContactResult;
60         
61         EditContactResult.RequestResult = TestRequestResult;
62         EditContactResult.EntityTag = TestEntityTag;
63         EditContactResult.SessionCode = TestSessionCode;
64         EditContactResult.ResultCode = TestResultCode;
65         EditContactResult.ResultMessage = TestResultMessage;
66         
67         return EditContactResult;       
68         
69 }
71 COServerResponse FakeConnectionObject::DeleteContact(std::string Location, std::string EntityTag){
72         
73         COServerResponse DeleteContactResult;
74         
75         DeleteContactResult.RequestResult = TestRequestResult;
76         DeleteContactResult.EntityTag = TestEntityTag;
77         DeleteContactResult.SessionCode = TestSessionCode;
78         DeleteContactResult.ResultCode = TestResultCode;
79         DeleteContactResult.ResultMessage = TestResultMessage;
80         
81         return DeleteContactResult;     
82         
83 }
85 COServerResponse FakeConnectionObject::GetServerEntityTagValue(std::string Location){
86         
87         COServerResponse EntityTagResult;
89         EntityTagResult.RequestResult = TestRequestResult;
90         EntityTagResult.EntityTag = TestEntityTag;
91         EntityTagResult.SessionCode = TestSessionCode;
92         EntityTagResult.ResultCode = TestResultCode;
93         EntityTagResult.ResultMessage = TestResultMessage;
94         
95         return EntityTagResult;
96         
97 }
99 COServerResponse FakeConnectionObject::GetContact(std::string Location){
100         
101         COServerResponse GetContactResult;
103         GetContactResult.RequestResult = TestRequestResult;
104         GetContactResult.EntityTag = TestEntityTag;
105         GetContactResult.SessionCode = TestSessionCode;
106         GetContactResult.ResultCode = TestResultCode;
107         GetContactResult.ResultMessage = TestResultMessage;
108         
109         return GetContactResult;        
110         
113 COContactList FakeConnectionObject::GetContactList(std::string SyncToken){
114         
115         COContactList GetContactListResult = TestContactList;
117         GetContactListResult.ServerResponse.RequestResult = TestRequestResult;
118         GetContactListResult.ServerResponse.EntityTag = TestEntityTag;
119         GetContactListResult.ServerResponse.SessionCode = TestSessionCode;
120         GetContactListResult.ServerResponse.ResultCode = TestResultCode;
121         GetContactListResult.ServerResponse.ResultMessage = TestResultMessage;
122         
123         return GetContactListResult;
124         
127 std::string FakeConnectionObject::GetServerAddress(){
128         return ServerAddress;
131 unsigned int FakeConnectionObject::GetServerPort(){
132         return ServerPort;
135 std::string FakeConnectionObject::GetServerUser(){
136         return ServerUser;      
139 std::string FakeConnectionObject::GetServerPass(){
140         return ServerPass;
143 std::string FakeConnectionObject::GetServerPrefix(){
144         return ServerPrefix;
147 std::string FakeConnectionObject::GetServerAccount(){
148         return ServerAccount;
151 bool FakeConnectionObject::GetServerSSL(){
152         return ServerSSL;
155 bool FakeConnectionObject::GetTestMode(){
156         return TestMode;
159 bool FakeConnectionObject::CanDoProcessing(){
160         return CanProcess;
163 bool FakeConnectionObject::CanDoSSL(){
164         return SSLStatus;       
167 COSSLVerified FakeConnectionObject::SSLVerify(){
168         return SSLVerified;
171 bool FakeConnectionObject::AbleToLogin(){
172         return AuthPassed;
175 bool FakeConnectionObject::HasValidResponse(){
176         return ValidResponse;
179 bool FakeConnectionObject::IsSelfSigned(){
180         return SSLSelfSigned;
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