Test Double Code
// Test to add - this should fail
[TestMethod]
public void CheckExternalTemperatureConverted(){
Converter tc = new Converter();
Assert.AreEqual(32.0, tc.ExternalToFahrenheit(), .02);
}
// Class to add:
public class ExternalTemperatureGetter {
private Random random = new Random();
public double GetTemperature(){
double value = random.Next(99);
return value;
}
}
// Method to add to Converter:
ExternalTemperatureGetter etc =
new ExternalTemperatureGetter();
public double ExternalToFahrenheit()
{
double temp = etc.GetTemperature();
return ToFahrenheit(temp);
}