Keep input when users refresh currency rates (#369)
Fixes #260 Description of the changes: prevent UnitConverterViewModel to reset values when users click on update rates. recompute UnitConverter's caches (m_ratioMap and m_categoryToUnits) once rates are updated (but check first if the user did/didn't change the category) How changes were validated: Manually tested with fake currency rates (HTTP responses modified on the fly via FiddlerCore) Verified that it works no matter the selected field (From or To) Verified that the currencies selected are kept after a refresh
This commit is contained in:
committed by
Daniel Belcher
parent
775771d62a
commit
ad25feda6b
@@ -42,11 +42,14 @@ namespace CalculatorUnitTests
|
||||
void SendCommand(UCM::Command command) override;
|
||||
void SetViewModelCallback(const std::shared_ptr<UCM::IUnitConverterVMCallback>& newCallback) override;
|
||||
void SetViewModelCurrencyCallback(_In_ const std::shared_ptr<UCM::IViewModelCurrencyCallback>& /*newCallback*/) override {}
|
||||
void Calculate() override {}
|
||||
void ResetCategoriesAndRatios() override{}
|
||||
concurrency::task<std::pair<bool, std::wstring>> RefreshCurrencyRatios() override
|
||||
{
|
||||
co_return std::make_pair(L"", L"");
|
||||
co_return std::make_pair(true, L"");
|
||||
}
|
||||
|
||||
|
||||
UINT m_initCallCount;
|
||||
UINT m_getCategoriesCallCount;
|
||||
UINT m_setCurrentCategoryCallCount;
|
||||
|
Reference in New Issue
Block a user