Esempio n. 1
0
        public void AddEmpty()
        {
            int       width    = 10;
            int       height   = 12;
            IDesigner theLevel = new Designer();

            theLevel.LevelBuilder(width, height);

            theLevel.AddEmpty(1, 1);
            Assert.AreEqual(theLevel.GetPartAtIndex(1, 1), Parts.Empty);
        }
Esempio n. 2
0
        public void TestIfEmptyReturnsString()
        {
            //arrange
            int       height   = 15;
            int       width    = 15;
            IDesigner theLevel = new Designer();

            theLevel.LevelBuilder(height, width);

            theLevel.AddEmpty(2, 2);

            string theType = theLevel.GetPartAtIndex(2, 2).ToString();

            Assert.IsInstanceOfType(theType, typeof(string), "Expected a string but got  something else. Please check!");

            Assert.AreEqual(theType, "Empty");
        }
Esempio n. 3
0
        public void ThrowAssertForAddingEmptyOutsideAGrid()
        {
            //arrange
            int       height   = 5;
            int       width    = 8;
            IDesigner theLevel = new Designer();

            theLevel.LevelBuilder(height, width);

            //Check that IndexOutOfRangeException is thrown if
            //attempting to add something outside of the grid

            try
            {
                theLevel.AddEmpty(6, 4);
            }
            catch (ArgumentException e)
            {
                // assert
                StringAssert.Contains(e.Message, OutOfGridMessage);
                return;
            }
            Assert.Fail("No exception was thrown. (Was allowed to place Empty outside of Grid)");
        }