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);
        }
Example #2
0
        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]);
        }
Example #3
0
 /// <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);
 }
Example #4
0
 /// <summary>
 /// Single field change
 /// </summary>
 public FieldsToChange(GridPoint point, T newValue) : this()
 {
     Add(point, newValue);
 }
Example #5
0
 public SingleChange(GridPoint point, T newValue)
 {
     Point    = point;
     NewValue = newValue;
 }
 public FieldValueChangedEventArgs(GridPoint point, T originalValue)
 {
     Point         = point;
     OriginalValue = originalValue;
 }