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

            // Act
            var dog = new Dog(name);

            // Assert
            Assert.AreEqual(name, dog.Name);
        }
Exemple #2
0
        public void Create_ShouldBeHungry()
        {
            // Arrange
            const string name = "dawg";

            // Act
            var dog = new Dog(name);

            // Assert
            Assert.IsTrue(dog.IsHungry);
        }
Exemple #3
0
        public void Eat_SuppliedFishFood_ShouldStillBeHungry()
        {
            // Arrange
            var dog = new Dog("dawg");
            var fishFood = new FishFood();

            // Act
            dog.Feed(fishFood);

            // Assert
            Assert.IsTrue(dog.IsHungry);
        }
Exemple #4
0
        public void Eat_SuppliedDogFood_ShouldNotBeHungry()
        {
            // Arrange
            var dog = new Dog("dawg");
            var dogFood = new DogFood();

            // Act
            dog.Feed(dogFood);

            // Assert
            Assert.IsFalse(dog.IsHungry);
        }
Exemple #5
0
        public void Move_DogNotHungry_ShouldMakeDogHungry()
        {
            // Arrange
            var dog = new Dog("Lady Dawg");
            dog.Feed(new DogFood());

            // Act
            dog.Move();

            // Assert
            Assert.True(dog.IsHungry);
        }
Exemple #6
0
        public void Speak_ShouldReturnWhatDogsSay()
        {
            // Arrange
            var dog = new Dog("Sir Dawg");

            // Act
            var speach = dog.Speak();

            // Assert
            Assert.AreEqual("Woof woof", speach);
        }
Exemple #7
0
        public void Move_IsHungry_ShouldThrowArgumentException()
        {
            // Arrange
            var dog = new Dog("Lord Dawg");

            // Act
            var exception = Assert.Throws<ArgumentException>(() => dog.Move());

            // Assert
            StringAssert.Contains("Cannot move while hungry", exception.Message);
        }