Exemple #1
0
        public void CanGetSameHashCodesForSameEntities()
        {
            var sut1 = new LifeInstance(1, 0).GetHashCode();
            var sut2 = new LifeInstance(1, 0).GetHashCode();

            Assert.AreEqual(sut1, sut2);
        }
Exemple #2
0
        public LifeInstanceEditor(LifeInstance item)
        {
            InitializeComponent();
            this.item             = item;
            infoEnable.Tag        = infoBox;
            limitedNameEnable.Tag = limitedNameBox;
            mobTimeEnable.Tag     = mobTimeBox;
            teamEnable.Tag        = teamBox;

            xInput.Value    = item.X;
            yInput.Value    = item.Y;
            rx0Box.Value    = item.rx0Shift;
            rx1Box.Value    = item.rx1Shift;
            yShiftBox.Value = item.yShift;

            LoadOptionalInt(item.Info, infoEnable, infoBox);
            LoadOptionalInt(item.Team, teamEnable, teamBox);
            LoadOptionalInt(item.MobTime, mobTimeEnable, mobTimeBox);
            LoadOptionalStr(item.LimitedName, limitedNameEnable, limitedNameBox);

            hideBox.Checked = item.Hide;
            flipBox.Checked = item.Flip;

            pathLabel.Text = HaCreatorStateManager.CreateItemDescription(item, "\r\n");
        }
Exemple #3
0
        public void CanGetDifferentHashCodesForSimilarEntities()
        {
            var sut1 = new LifeInstance(1, 0).GetHashCode();
            var sut2 = new LifeInstance(0, 1).GetHashCode();

            Assert.AreNotEqual(sut1, sut2);
        }
Exemple #4
0
        public void CanGetLifeInstanceNeighbouringCells()
        {
            var sut   = new LifeInstance(0, 0);
            var cells = sut.GetNeighbouringCells();

            Assert.IsNotNull(cells);
            Assert.AreEqual(8, cells.Count); // 8 neighbours of cell in 2D space
        }
Exemple #5
0
        public void CanCalculateNoOfNeighbours()
        {
            var sut           = new GameService();
            var lifeUnderTest = new LifeInstance(10, 10);

            sut.AddLife(lifeUnderTest);
            var result = sut.GetNumberOfNeighbours(lifeUnderTest);

            Assert.AreEqual(0, result);

            sut.AddLife(9, 10); // Add life one position to the left
            result = sut.GetNumberOfNeighbours(lifeUnderTest);
            Assert.AreEqual(1, result);

            sut.AddLife(8, 10); // Add life two positions to the left, not a neighbour
            result = sut.GetNumberOfNeighbours(lifeUnderTest);
            Assert.AreEqual(1, result);

            sut.AddLife(10, 11); // Add life one position above
            result = sut.GetNumberOfNeighbours(lifeUnderTest);
            Assert.AreEqual(2, result);
        }
        public LifeInstanceEditor(LifeInstance item)
        {
            InitializeComponent();
            this.item = item;
            infoEnable.Tag = infoBox;
            limitedNameEnable.Tag = limitedNameBox;
            mobTimeEnable.Tag = mobTimeBox;
            teamEnable.Tag = teamBox;

            xInput.Value = item.X;
            yInput.Value = item.Y;
            rx0Box.Value = item.rx0Shift;
            rx1Box.Value = item.rx1Shift;
            yShiftBox.Value = item.yShift;
            LoadOptionalInt(item.Info, infoEnable, infoBox);
            LoadOptionalInt(item.Team, teamEnable, teamBox);
            LoadOptionalInt(item.MobTime, mobTimeEnable, mobTimeBox);
            LoadOptionalStr(item.LimitedName, limitedNameEnable, limitedNameBox);
            hideBox.Checked = item.Hide;

            pathLabel.Text = HaCreatorStateManager.CreateItemDescription(item, "\r\n");
        }
Exemple #7
0
        public LifeInstanceEditor(LifeInstance item)
        {
            InitializeComponent();
            this.item = item;
            styleManager.ManagerStyle = UserSettings.applicationStyle;
            infoEnable.Tag            = infoBox;
            limitedNameEnable.Tag     = limitedNameBox;
            mobTimeEnable.Tag         = mobTimeBox;
            teamEnable.Tag            = teamBox;
            //typeEnable.Tag = typeBox;

            xInput.Value = item.X;
            yInput.Value = item.Y;
            rx0Box.Value = item.rx0;
            rx1Box.Value = item.rx1;
            LoadOptionalInt(item.Info, infoEnable, infoBox);
            LoadOptionalInt(item.Team, teamEnable, teamBox);
            LoadOptionalInt(item.MobTime, mobTimeEnable, mobTimeBox);
            //LoadOptionalStr(item.TypeStr, typeEnable, typeBox);
            LoadOptionalStr(item.LimitedName, limitedNameEnable, limitedNameBox);
            hideBox.Checked = item.Hide;

            pathLabel.Text = Editor.CreateItemDescription(item, "\r\n");
        }
Exemple #8
0
        public void CanCreateLifeInstance()
        {
            var sut = new LifeInstance(0, 0);

            Assert.IsNotNull(sut);
        }