public void TestAdd() { var p12 = new GridPoint(1, 2); var p14 = new GridPoint(1, 4); var changes = new FieldsToChange <int> { { p12, 7 }, { p14, 8 } }; AssertEqualFieldChanges( new List <SingleChange <int> >() { new SingleChange <int>(p12, 7), new SingleChange <int>(p14, 8) }, changes); }
public void TestGetSetFieldValue() { var grid = new Grid <int>(1, 2); var p0 = new GridPoint(0, 0); var p1 = new GridPoint(0, 1); Assert.AreEqual(0, grid[p0]); Assert.AreEqual(0, grid[p1]); grid[p0] = 15; Assert.AreEqual(15, grid[p0]); Assert.AreEqual(0, grid[p1]); grid[p1] = -7; Assert.AreEqual(15, grid[p0]); Assert.AreEqual(-7, grid[p1]); }
/// <summary> /// Add a single field change. Overwrites earlier changes at the same point. /// </summary> public void Add(GridPoint point, T newValue) { fieldChanges[point] = new SingleChange <T>(point, newValue); }
/// <summary> /// Single field change /// </summary> public FieldsToChange(GridPoint point, T newValue) : this() { Add(point, newValue); }
public SingleChange(GridPoint point, T newValue) { Point = point; NewValue = newValue; }
public FieldValueChangedEventArgs(GridPoint point, T originalValue) { Point = point; OriginalValue = originalValue; }