public void Add_FunctionNameUsed_ExceptionReturned() { var fs = new FunctionStorage(); fs.Add("Name", new Linear(1, 2)); Assert.Catch <Exception>(() => fs.Add("Name", new Linear(2, 1))); }
public void Rename_RenameExistingFunction_FunctionWillBeRenamed() { var fs = new FunctionStorage(); fs.Add("Name", new Cos()); fs.Rename("Name", "Name1"); fs.Add("Name", new Cos()); }
public void Delete_DeleteExistingFunction_FunctionWillBeDeleted() { var fs = new FunctionStorage(); fs.Add("Name", new Cos()); fs.Delete("Name"); fs.Add("Name", new Cos()); }
// TODO: Добавить проверку кол-ва аргументов public MathBase(string name = "Math") : base(name) { OperatorId = GenerateOperatorId(); FunctionStorage.Add("E", new E()); FunctionStorage.Add("PI", new Pi()); FunctionStorage.Add("Tau", new Tau()); FunctionStorage.Add("Abs", new Abs()); FunctionStorage.Add("Acos", new Acos()); FunctionStorage.Add("Asin", new Asin()); FunctionStorage.Add("Atan", new Atan()); FunctionStorage.Add("Atanh", new Atanh()); FunctionStorage.Add("Cos", new Cos()); FunctionStorage.Add("Sin", new Sin()); FunctionStorage.Add("Tan", new Tan()); FunctionStorage.Add("Tanh", new Tanh()); FunctionStorage.Add("Ceil", new Ceil()); FunctionStorage.Add("Floor", new Floor()); FunctionStorage.Add("Round", new Round()); FunctionStorage.Add("Truncate", new Truncate()); FunctionStorage.Add("Log", new Log()); FunctionStorage.Add("Log10", new Log10()); FunctionStorage.Add("Log2", new Log2()); FunctionStorage.Add("Pow", new Pow()); FunctionStorage.Add("Cbrt", new Cbrt()); FunctionStorage.Add("Sqrt", new Sqrt()); FunctionStorage.Add("Exp", new Exp()); FunctionStorage.Add("Mod", new Mod()); FunctionStorage.Add("Max", new Max()); FunctionStorage.Add("Min", new Min()); }
public void Derivative_DerivativeExistingFunction_DerivativeWillBeCalculated() { var fs = new FunctionStorage(); fs.Add("Name", new Linear(2, 1)); var expectedResult = new Linear(0, 2); Assert.AreEqual(expectedResult, fs.Derivative("Name")); }
public void ValueAtThePoint_ExistingFunction_ValueWillBeCalculated() { var fs = new FunctionStorage(); fs.Add("Name", new Linear(2, 1)); const double point = 2; const int expectedResult = 5; Assert.AreEqual(expectedResult, fs.ValueAtThePoint("Name", point)); }
public void Execute_DeleteExistingFunction_FunctionWillBeDeleted() { var fs = new FunctionStorage(); var command = new DeleteFromStorage("name"); fs.Add("name", new Cos()); var res = command.Execute(fs); const string expectedResult = "Функция удалена"; Assert.AreEqual(expectedResult, res); }
public void Execute_AddExistingFunctionFunction_ErrorReturned() { var fs = new FunctionStorage(); var command = new AddInStorage("name", new Cos()); fs.Add("name", new Sin()); var res = command.Execute(fs); const string expectedResult = "name уже используется"; Assert.AreEqual(expectedResult, res); }
public void Execute_DerivativeExistingFunction_DerivativeWillBeCalculated() { var fs = new FunctionStorage(); fs.Add("Name", new Linear(2, 1)); var command = new DerivativeOfTheFunction("Name"); var res = command.Execute(fs); const string expectedResult = "Функция добавлена в хранилище.\nПроизводная Name = 2"; Assert.AreEqual(expectedResult, res); }
public void Execute_RenameExistingFunction_FunctionWillBeRenamed() { var fs = new FunctionStorage(); fs.Add("oldName", new Cos()); var command = new RenameFunction("oldName", "newName"); var res = command.Execute(fs); const string expectedResult = "Функция перименована"; Assert.AreEqual(expectedResult, res); }
public void Execute_ExistingFunction_ValueWillBeCalculated() { var fs = new FunctionStorage(); fs.Add("Name", new Linear(2, 1)); const double point = 2; var command = new ValueFunction("Name", point); var res = command.Execute(fs); const string expectedResult = "Значение Name в точке 2 = 5"; Assert.AreEqual(expectedResult, res); }
public FilesBase(string name = "FilesBase") : base(name) { OperatorId = GenerateOperatorId(); FunctionStorage.Add("Exists", new Exists()); FunctionStorage.Add("Open", new Open()); FunctionStorage.Add("Close", new Close()); FunctionStorage.Add("ReadInteger", new ReadInteger()); FunctionStorage.Add("ReadReal", new ReadReal()); FunctionStorage.Add("ReadString", new ReadString()); FunctionStorage.Add("ReadChar", new ReadChar()); FunctionStorage.Add("ReadBoolean", new ReadBoolean()); FunctionStorage.Add("Write", new Write()); FunctionStorage.Add("Position", new Position()); FunctionStorage.Add("Seek", new Seek()); FunctionStorage.Add("SeekBeg", new SeekBeg()); FunctionStorage.Add("SeekCur", new SeekCur()); FunctionStorage.Add("SeekEnd", new SeekEnd()); }
public void Add_FunctionNameNotUsed_FunctionWillBeAdded() { var fs = new FunctionStorage(); fs.Add("Name", new Linear(2, 1)); }