Fix the project code style, as it is not consistent. (#236)
Fixes #202 This PR fixes code style for the project files. The Problem Different files in the project use different code style. That is not consistent and leads to harder maintenance of the project. Description of the changes: Have investigated and determined the most used code style across the given codebase Have configured IDE and applied code style to all project files. Have crafted clang-formatter config. see https://clang.llvm.org/docs/ClangFormat.html https://clang.llvm.org/docs/ClangFormatStyleOptions.html Some cases were fixed manually How changes were validated: manual/ad-hoc testing, automated testing All tests pass as before because these are only code style changes. Additional Please review, and let me know if I have any mistake in the code style. In case of any mistake, I will change the configuration and re-apply it to the project.
This commit is contained in:
committed by
Daniel Belcher
parent
c77f1de84c
commit
2826d37056
@@ -13,35 +13,36 @@ using namespace Windows::System::UserProfile;
|
||||
using namespace Windows::Web::Http;
|
||||
|
||||
// Generic responses so unit tests will pass.
|
||||
static constexpr auto STATIC_DATA_RESPONSE = LR"([{"CountryCode":"USA","CountryName":"United States","CurrencyCode":"USD","CurrencyName":"Dollar","CurrencySymbol":"$"},{"CountryCode":"EUR","CountryName":"Europe","CurrencyCode":"EUR","CurrencyName":"Euro","CurrencySymbol":"€"}])";
|
||||
static constexpr auto ALL_RATIOS_RESPONSE = LR"([{"An":"USD","Ch":0,"Pc":0,"Rt":1},{"An":"EUR","Ch":0.003803,"Pc":0.4149,"Rt":0.920503,"Yh":0.9667,"Yl":0.86701}])";
|
||||
static constexpr auto STATIC_DATA_RESPONSE =
|
||||
LR"([{"CountryCode":"USA","CountryName":"United States","CurrencyCode":"USD","CurrencyName":"Dollar","CurrencySymbol":"$"},{"CountryCode":"EUR","CountryName":"Europe","CurrencyCode":"EUR","CurrencyName":"Euro","CurrencySymbol":"€"}])";
|
||||
static constexpr auto ALL_RATIOS_RESPONSE =
|
||||
LR"([{"An":"USD","Ch":0,"Pc":0,"Rt":1},{"An":"EUR","Ch":0.003803,"Pc":0.4149,"Rt":0.920503,"Yh":0.9667,"Yl":0.86701}])";
|
||||
|
||||
CurrencyHttpClient::CurrencyHttpClient()
|
||||
{
|
||||
}
|
||||
|
||||
String^ CurrencyHttpClient::GetRawStaticDataResponse()
|
||||
String ^ CurrencyHttpClient::GetRawStaticDataResponse()
|
||||
{
|
||||
return StringReference(STATIC_DATA_RESPONSE);
|
||||
}
|
||||
|
||||
String^ CurrencyHttpClient::GetRawAllRatiosDataResponse()
|
||||
String ^ CurrencyHttpClient::GetRawAllRatiosDataResponse()
|
||||
{
|
||||
return StringReference(ALL_RATIOS_RESPONSE);
|
||||
}
|
||||
|
||||
IAsyncOperationWithProgress<String^, HttpProgress>^ CurrencyHttpClient::GetCurrencyMetadata()
|
||||
IAsyncOperationWithProgress<String ^, HttpProgress> ^ CurrencyHttpClient::GetCurrencyMetadata()
|
||||
{
|
||||
return ref new MockAsyncOperationWithProgress(StringReference(STATIC_DATA_RESPONSE));
|
||||
}
|
||||
|
||||
IAsyncOperationWithProgress<String^, HttpProgress>^ CurrencyHttpClient::GetCurrencyRatios()
|
||||
IAsyncOperationWithProgress<String ^, HttpProgress> ^ CurrencyHttpClient::GetCurrencyRatios()
|
||||
{
|
||||
return ref new MockAsyncOperationWithProgress(StringReference(ALL_RATIOS_RESPONSE));
|
||||
}
|
||||
|
||||
MockAsyncOperationWithProgress::MockAsyncOperationWithProgress(String^ result) :
|
||||
m_result(result)
|
||||
MockAsyncOperationWithProgress::MockAsyncOperationWithProgress(String ^ result) : m_result(result)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -14,23 +14,28 @@ namespace CalculatorApp
|
||||
public:
|
||||
CurrencyHttpClient();
|
||||
|
||||
static Platform::String^ GetRawStaticDataResponse();
|
||||
static Platform::String^ GetRawAllRatiosDataResponse();
|
||||
static Platform::String ^ GetRawStaticDataResponse();
|
||||
static Platform::String ^ GetRawAllRatiosDataResponse();
|
||||
|
||||
// ICurrencyHttpClient
|
||||
void SetSourceCurrencyCode(Platform::String^ sourceCurrencyCode) override {}
|
||||
void SetResponseLanguage(Platform::String^ responseLanguage) override {}
|
||||
void SetSourceCurrencyCode(Platform::String ^ sourceCurrencyCode) override
|
||||
{
|
||||
}
|
||||
void SetResponseLanguage(Platform::String ^ responseLanguage) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual Windows::Foundation::IAsyncOperationWithProgress<Platform::String^, Windows::Web::Http::HttpProgress>^ GetCurrencyMetadata() override;
|
||||
virtual Windows::Foundation::IAsyncOperationWithProgress<Platform::String^, Windows::Web::Http::HttpProgress>^ GetCurrencyRatios() override;
|
||||
virtual Windows::Foundation::IAsyncOperationWithProgress<Platform::String ^, Windows::Web::Http::HttpProgress> ^ GetCurrencyMetadata() override;
|
||||
virtual Windows::Foundation::IAsyncOperationWithProgress<Platform::String ^, Windows::Web::Http::HttpProgress> ^ GetCurrencyRatios() override;
|
||||
// ICurrencyHttpClient
|
||||
};
|
||||
|
||||
public ref class MockAsyncOperationWithProgress sealed :
|
||||
public Windows::Foundation::IAsyncOperationWithProgress<Platform::String^, Windows::Web::Http::HttpProgress>
|
||||
public
|
||||
ref class MockAsyncOperationWithProgress sealed
|
||||
: public Windows::Foundation::IAsyncOperationWithProgress<Platform::String ^, Windows::Web::Http::HttpProgress>
|
||||
{
|
||||
public:
|
||||
MockAsyncOperationWithProgress(Platform::String^ result);
|
||||
MockAsyncOperationWithProgress(Platform::String ^ result);
|
||||
|
||||
// IAsyncInfo
|
||||
virtual property Windows::Foundation::HResult ErrorCode
|
||||
@@ -40,16 +45,26 @@ namespace CalculatorApp
|
||||
|
||||
virtual property unsigned int Id
|
||||
{
|
||||
unsigned int get() { return 128u; }
|
||||
unsigned int get()
|
||||
{
|
||||
return 128u;
|
||||
}
|
||||
}
|
||||
|
||||
virtual property Windows::Foundation::AsyncStatus Status
|
||||
{
|
||||
Windows::Foundation::AsyncStatus get() { return Windows::Foundation::AsyncStatus::Completed; }
|
||||
Windows::Foundation::AsyncStatus get()
|
||||
{
|
||||
return Windows::Foundation::AsyncStatus::Completed;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Cancel() {}
|
||||
virtual void Close() {}
|
||||
virtual void Cancel()
|
||||
{
|
||||
}
|
||||
virtual void Close()
|
||||
{
|
||||
}
|
||||
// IAsyncInfo
|
||||
|
||||
// IAsyncOperationWithProgress
|
||||
|
Reference in New Issue
Block a user