コード例 #1
0
        public void ValueProperty_WhenCellScratchpadIsMutable_ValueIsChanged()
        {
            var scratchPadCell = new CellScratchpad(3, 4);

            scratchPadCell.Value = 5;

            Assert.Equal(5, scratchPadCell.Value);
        }
コード例 #2
0
        public void AddCandidates_WhenAddingValues_IsSuccessful()
        {
            var addedValues    = new int[] { 3, 4, 5 };
            var scratchPadCell = new CellScratchpad(2, 2);

            scratchPadCell.AddCandidates(addedValues[0], addedValues[1], addedValues[2]);

            Assert.True(scratchPadCell.Candidates.Count() == 3 &&
                        scratchPadCell.Candidates.All(a => addedValues.Contains(a)));
        }
コード例 #3
0
        public void AddCandidates_WhenRemovingValues_IsSuccessful()
        {
            var addedValues    = new int[] { 3, 4, 5 };
            var scratchPadCell = new CellScratchpad(2, 2);

            scratchPadCell.AddCandidates(addedValues);

            scratchPadCell.RemoveCandidates(3, 5);

            Assert.True(scratchPadCell.Candidates.Count() == 1 && scratchPadCell.Candidates.First() == 4);
        }
コード例 #4
0
        public void Constructor_WhenCellHasOriginalValue_CreatesImmutableCell()
        {
            var scratchPadCell = new CellScratchpad(3, 4, 5);

            var(row, column) = scratchPadCell.CellLocation;

            Assert.NotNull(scratchPadCell);
            Assert.NotNull(scratchPadCell.Candidates);
            Assert.Equal(3, row);
            Assert.Equal(4, column);
            Assert.True(scratchPadCell.Immutable);
        }
コード例 #5
0
        public void ValueProperty_WhenCellScratchpadIsImmutable_ThrowsException()
        {
            var scratchPadCell = new CellScratchpad(3, 4, 5);

            Assert.Throws <InvalidOperationException>(() => scratchPadCell.Value = 2);
        }