public void TestEndNewCancelsOnUncommittedValues() { IFunction function = new Function(); function.Arguments.Add(new Variable <int>()); function.Components.Add(new Variable <int>()); var functionBindingList = new FunctionBindingList(function); // add one real row functionBindingList.AddNew(); functionBindingList[0][0] = 1; functionBindingList[0][1] = 2; functionBindingList[0].EndEdit(); //commits functionBindingList.EndNew(0); // add one row (but do not commit) functionBindingList.AddNew(); functionBindingList[1][1] = 3; Assert.AreEqual(2, functionBindingList.Count); functionBindingList.EndNew(1); //should cause a cancel: uncommitted values Assert.AreEqual(1, functionBindingList.Count); }
public void TestAddNewCoreUsesValueGenerationDelegate() { IFunction function = new Function(); function.Arguments.Add(new Variable <TestClass>()); function.Components.Add(new Variable <int>()); FunctionBindingList functionBindingList = new FunctionBindingList(function); //add two values..the first one is always OK!!?? functionBindingList.AddNew(); functionBindingList.AddNew(); Assert.AreEqual(2, function.Arguments[0].Values.Count); }
public void AddRowsToBindingListUpdatesFunction() { IFunction function = new Function(); function.Arguments.Add(new Variable <int>("x1")); function.Components.Add(new Variable <string>("y1")); function[0] = "zero"; function[1] = "one"; function[2] = "two"; IFunctionBindingList functionBindingList = new FunctionBindingList { Function = function }; functionBindingList.AddNew(); var row = (FunctionBindingListRow)functionBindingList[3]; // row[0] = 3; row[1] = "three"; WaitUntilLastOperationIsFinished(functionBindingList); Assert.AreEqual(row[1], function[3]); }
public void TestAddNewCoreUsesValueGenerationDelegate() { IFunction function = new Function(); var variable = new Variable <TestClass>(); variable.NextValueGenerator = new TestClassNextValueGenerator(); function.Arguments.Add(variable); function.Components.Add(new Variable <int>()); FunctionBindingList functionBindingList = new FunctionBindingList(function); //add two values..the first one is always OK!!?? functionBindingList.AddNew(); Assert.AreEqual("kees", variable.Values[0].Name); }
public void AddRowsToBindingListUpdatesFunction() { IFunction function = new Function(); function.Arguments.Add(new Variable <int>("x1")); function.Components.Add(new Variable <string>("y1")); function[0] = "zero"; function[1] = "one"; function[2] = "two"; IFunctionBindingList functionBindingList = new FunctionBindingList(function); functionBindingList.AddNew(); var row = (FunctionBindingListRow)functionBindingList[3]; // row[0] = 3; row[1] = "three"; row.EndEdit(); Assert.AreEqual(row[1], function[3]); }
public void TestAddNewCoreUsesValueGenerationDelegate() { IFunction function = new Function(); function.Arguments.Add(new Variable<TestClass>()); function.Components.Add(new Variable<int>()); FunctionBindingList functionBindingList = new FunctionBindingList(function); //add two values..the first one is always OK!!?? functionBindingList.AddNew(); functionBindingList.AddNew(); Assert.AreEqual(2, function.Arguments[0].Values.Count); }
public void AddRowsToBindingListUpdatesFunction() { IFunction function = new Function(); function.Arguments.Add(new Variable<int>("x1")); function.Components.Add(new Variable<string>("y1")); function[0] = "zero"; function[1] = "one"; function[2] = "two"; IFunctionBindingList functionBindingList = new FunctionBindingList { Function = function }; functionBindingList.AddNew(); var row = (FunctionBindingListRow)functionBindingList[3]; // row[0] = 3; row[1] = "three"; WaitUntilLastOperationIsFinished(functionBindingList); Assert.AreEqual(row[1], function[3]); }