コード例 #1
0
ファイル: EmptyTests.cs プロジェクト: simonwendel/gameoflife
        public void Constructor_WhenInvoked_PreparesEmptyPatternCorrectly()
        {
            // act
            var empty = new Empty();

            int oneSide   = empty.GetPattern().Length;
            int otherSide = empty.GetPattern().Max(x => x.Length);

            // assert
            Assert.IsTrue(
                oneSide == 1 && oneSide == otherSide,
                message: "The empty pattern was not of size 1x1.");

            Assert.IsTrue(
                empty.IsStable,
                message: "The empty pattern was not stable.");

            Assert.AreEqual(
                expected: 0,
                actual: empty.StabilizesAt,
                message: "The empty pattern stabilizes at the wrong time.");

            Assert.AreEqual(
                expected: 0,
                actual: empty.StablePopulation,
                message: "The empty pattern has wrong number of cells in the stable population.");
        }