You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
953 B

using System;
namespace Calculator
{
public class CalculationResponse
{
public static CalculationResponse Ok = new CalculationResponse(Response.Ok, null);
public static CalculationResponse ClearedMemory = new CalculationResponse(Response.ClearedMemory, null);
public static CalculationResponse WrongInput = new CalculationResponse(Response.WrongInput, null);
public Response Response { get; }
public string Result { get; }
public CalculationResponse(Response response, string result)
{
if (response == Response.Result && result == "")
throw new ArgumentNullException("CalculationResponse cannot have Response = RESULT and result = null");
Response = response;
Result = result;
}
}
public enum Response
{
Ok,
Result,
ClearedMemory,
WrongInput
}
}