The below code lives in an instance class with no constructor, I don't know from where to start writing unit tests for it.
E.g price is "2/9" so secondPart is 9 also the _random is an object of Random class
public string RefreshPrice(string price, out bool isUpOrDown, out bool isChanged)
{
if (string.IsNullOrEmpty(price))
{
isUpOrDown = false;
isChanged = false;
return price;
}
int secondPart;
string[] priceParts = price.Split('/');
int newPrice = 0;
if(int.TryParse(priceParts[1], out secondPart))
{
newPrice = secondPart >= 2 ? _random.Next(2, 20) : 2;
}
isUpOrDown = (newPrice > secondPart);
isChanged = (newPrice != secondPart);
secondPart = newPrice;
return string.Format("{0}/{1}", priceParts[0], secondPart);
}