Ejemplo n.º 1
0
        public void TestSingleChange()
        {
            var p12     = new GridPoint(1, 2);
            var changes = new FieldsToChange <int>(p12, 7);

            AssertEqualFieldChanges(
                new List <SingleChange <int> >()
            {
                new SingleChange <int>(p12, 7)
            },
                changes);
        }
Ejemplo n.º 2
0
        public void TestOverwrite()
        {
            var p12     = new GridPoint(1, 2);
            var changes = new FieldsToChange <int>
            {
                { p12, 7 },
                { p12, 9 },
                { p12, 1 },
            };

            AssertEqualFieldChanges(
                new List <SingleChange <int> >()
            {
                new SingleChange <int>(p12, 1),
            },
                changes);
        }
Ejemplo n.º 3
0
        public void TestSeveralChanges()
        {
            int numValues = 2;
            var p12       = new GridPoint(1, 2);
            var changes   = new FieldsToChange <int>(
                p12,
                Direction.RIGHT,
                Enumerable.Range(7, numValues));

            AssertEqualFieldChanges(
                new List <SingleChange <int> >()
            {
                new SingleChange <int>(p12, 7),
                new SingleChange <int>(new GridPoint(1, 3), 8)
            },
                changes);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        private void AssertEqualFieldChanges(List <SingleChange <int> > expectedFieldChanges, FieldsToChange <int> actualFieldChanges)
        {
            Assert.AreEqual(expectedFieldChanges.Count, actualFieldChanges.Count());

            foreach (var actualChange in actualFieldChanges)
            {
                Assert.IsTrue(expectedFieldChanges.Contains(actualChange));
            }
        }
Ejemplo n.º 6
0
        public void TestNoChanges()
        {
            var changes = new FieldsToChange <int>();

            AssertEqualFieldChanges(new List <SingleChange <int> >(), changes);
        }