Esempio n. 1
0
        public void AddService_Should_Throw_ArgumentNullException_When_Service_Is_Null()
        {
            // Arrange
            var hamster = new Hamster("name", AnimalGenderType.male, 1);

            // Act & Assert
            Assert.ThrowsException <ArgumentNullException>(() => hamster.AddServices(null));
        }
Esempio n. 2
0
        public void AddService_Should_Add_Service_To_ListOfServices()
        {
            // Arrange
            var service = new Mock <IService>().Object;
            var hamster = new Hamster("name", AnimalGenderType.male, 1);

            // Act
            hamster.AddServices(service);

            // Assert
            Assert.IsTrue(hamster.Services.Contains(service));
        }
Esempio n. 3
0
        public void ListAnimalServices_Should_Return_Correct_Value()
        {
            // Arrange
            var service = new Mock <IService>();

            service.Setup(x => x.Name).Returns("ServiceName");
            var hamster = new Hamster("name", AnimalGenderType.male, 1);

            hamster.AddServices(service.Object);

            var sb = new StringBuilder();

            sb.AppendLine("All services: ");
            sb.AppendLine($"Service: ServiceName");
            string expected = sb.ToString();

            // Act
            string actual = hamster.ListAnimalServices();

            // Assert
            Assert.AreEqual(expected, actual);
        }