Exemple #1
0
        public void Create_SuppliedName_ShouldSetTheNameProperty()
        {
            // Arrange
            const string name = "Mr Meow";

            // Act
            var cat = new Cat(name);

            // Assert
            Assert.AreEqual(name, cat.Name);
        }
Exemple #2
0
        public void Create_ShouldNotBeHungry()
        {
            // Arrange
            const string name = "Mr Meow";

            // Act
            var cat = new Cat(name);

            // Assert
            Assert.IsFalse(cat.IsHungry);
        }
Exemple #3
0
        public void Eat_SuppliedFishFood_ShouldthrowArgumentException()
        {
            // Arrange
            var cat = new Cat("Mr Meow");
            var fishFood = new FishFood();

            // Act
            var exception = Assert.Throws<ArgumentException>(() => cat.Feed(fishFood));

            // Assert
            StringAssert.Contains("Cats can only eat CatFood", exception.Message);
        }
Exemple #4
0
        public void Eat_SuppliedCatFood_ShouldNotBeHungry()
        {
            // Arrange
            var cat = new Cat("Mr Meow");
            var catFood = new CatFood();

            // Act
            cat.Feed(catFood);

            // Assert
            Assert.IsFalse(cat.IsHungry);
        }