public void CreateToothpaste_WhenNameParamLenghtIsOutOfRange_ShouldThrowIndexOutOfRangeException(string nameParam)
        {
            // Arrange
            var cosmeticFactory = new CosmeticsFactory();

            // Act && Assert
            Assert.Throws<IndexOutOfRangeException>(() => cosmeticFactory.CreateToothpaste(nameParam, "example", 10M, GenderType.Unisex, new List<string>() { "Zele", "Chesun" }));
        }
        public void CreateToothpaste_WhenNameParamIsNullOrEmpty_ShouldThrowNullReferenceException(string nameParam)
        {
            // Arrange
            var cosmeticFactory = new CosmeticsFactory();

            // Act && Assert
            Assert.Throws<NullReferenceException>(() => cosmeticFactory.CreateToothpaste(nameParam, "example", 10M, GenderType.Unisex, new List<string>() { "Zele", "Chesun" }));
        }
        public void CreateToothpaste_WhenNameParamIsValid_ShouldReturnInstanceOfToothpaste()
        {
            // Arrange
            var cosmeticFactory = new CosmeticsFactory();

            // Act
            var executionResult = cosmeticFactory.CreateToothpaste("Gosho", "example", 10M, GenderType.Unisex, new List<string>() { "Zele", "Chesun" });

            // Assert
            Assert.IsInstanceOf<IToothpaste>(executionResult);
        }
        public void CreateToothpaste_WhenIngredientsHaveInvalidLenght_ShouldThrowIndexOutOfRangeException(params string[] ingredients )
        {
            // Arrange
            var cosmeticFactory = new CosmeticsFactory();

            // Act && Assert
            Assert.Throws<IndexOutOfRangeException>(() => cosmeticFactory.CreateToothpaste("Gosho", "example", 10M, GenderType.Unisex, ingredients.ToList()));
        }
Пример #5
0
        public void TestCreateToothpaste_PassValidParameters_ShouldCreateToothpaste(string name, string brand)
        {
            var factory = new CosmeticsFactory();
            var paste = factory.CreateToothpaste(name, brand, 10M, GenderType.Unisex, new List<string>() { "Zele", "Chesun" });

            Assert.IsNotNull(paste);
            Assert.IsTrue(paste.Name == name);
            Assert.IsTrue(paste.Brand == brand);
        }
Пример #6
0
        public void TestCreateToothpaste_PassLongerName_ShouldTHrowIndexOutOfRange(string name)
        {
            var factory = new CosmeticsFactory();

            Assert.Throws<IndexOutOfRangeException>(() => factory.CreateToothpaste(name, "example", 10M, GenderType.Unisex, new List<string>() { "Zele", "Chesun" }));
        }
Пример #7
0
 public void TestCreateToothpaste_PassLongerCOmponents_ShouldThrowINdexOutOfRange(string description)
 {
     var factory = new CosmeticsFactory();
     Assert.Throws<IndexOutOfRangeException>(() => factory.CreateToothpaste("name", "brand", 10M, GenderType.Unisex, new List<string>() { description, "Chesun" }));
 }
Пример #8
0
        public void TestCreateToothpaste_PassInvalidName_ShouldTHrowNullReferenceException(string name)
        {
            var factory = new CosmeticsFactory();

            Assert.Throws<NullReferenceException>(() => factory.CreateToothpaste(name, "example", 10M, GenderType.Unisex, new List<string>() { "Zele", "Chesun" }));
        }