public void CloneTest() { /*** ARRANGE ***/ Alphabet target = new Alphabet() { 1, 2, 3 }; Alphabet actual; /*** ACT ***/ actual = target.Clone(); /*** ASSERT ***/ Assert.AreEqual(target, actual); // clone has same values Assert.AreNotSame(target, actual); // clone is not the same instance }
/// <summary> /// Initializes a new instance of the Sudoku.Common.Cell class /// with the specified puzzle alphabet and observer. /// </summary> /// <param name="alphabet">The collection of all possible cell values.</param> /// <param name="cellObserver">The observer of this cell.</param> public Cell(Alphabet alphabet, ICellObserver cellObserver) { _CellObserver = cellObserver; _RemainingPossibilities = alphabet.Clone(); }
/// <summary> /// Initializes a new instance of the Sudoku.Common.Cell class /// with the specified puzzle alphabet. /// </summary> /// <param name="alphabet">The collection of all possible cell values.</param> public Cell(Alphabet alphabet) { _RemainingPossibilities = alphabet.Clone(); }
/// <summary> /// Initializes a new instance of the <see cref="BaseChain"/> class /// with provided building and alphabet. /// Only simple validation is made. /// </summary> /// <param name="building"> /// The building of chain. /// </param> /// <param name="alphabet"> /// The alphabet of chain. /// </param> public BaseChain(int[] building, Alphabet alphabet) : this(building.Length) { if (building.Max() + 1 != alphabet.Cardinality) { throw new ArgumentException("Building max value does not corresponds with alphabet length."); } this.building = (int[])building.Clone(); this.alphabet = (Alphabet)alphabet.Clone(); }