> [...] The analyzer has detected two identical code fragments executing immediately one after the other. It looks like this code was written using the copy-paste technique and the programmer forgot to modify the copies.
Here Value2Active is a C++/CX property rigged to a PropertyChanged event [1] with a macro:
public ref class UnitConverterViewModel sealed: public Windows::UI::Xaml::Data::INotifyPropertyChanged
{
// other members omitted
OBSERVABLE_OBJECT();
OBSERVABLE_PROPERTY_RW(bool, Value2Active);
};
Can you be sure that this actually does not have a side effect? I bet not. Indeed, the intention of the original test is clear: a property, once set ("Switch") to a particular value, should not update other states even when set ("Reselect") to that same value---as it will really trigger a side effect! This idempotency guarantee is an important interface contract worth testing, no matter what a linter and clueless blog author says.
Here Value2Active is a C++/CX property rigged to a PropertyChanged event [1] with a macro:
Can you be sure that this actually does not have a side effect? I bet not. Indeed, the intention of the original test is clear: a property, once set ("Switch") to a particular value, should not update other states even when set ("Reselect") to that same value---as it will really trigger a side effect! This idempotency guarantee is an important interface contract worth testing, no matter what a linter and clueless blog author says.[1] https://github.com/Microsoft/calculator/blob/master/docs/App...