Esempio n. 1
0
        public void CreateCategory_ShouldThrowNullReferenceException_IfNameIsInvalid(string name)
        {
            //Arrange
            var cosmeticsFactory = new CosmeticsFactory();

            //Act and Assert
            Assert.Throws <NullReferenceException>(() => cosmeticsFactory.CreateCategory(name));
        }
        public void ThrowIndexOutOfRangeException_WhenThePassedNameParamLengthIsOutOfThePermittedRange(string name)
        {
            //Arrange
            var factory = new CosmeticsFactory();

            // Act & Assert
            Assert.Throws <IndexOutOfRangeException>(() => factory.CreateCategory(name));
        }
        public void CreateCategory_WhenNameParamIsNullOrEmpty_ShouldThrowNullReferenceException(string nameParam)
        {
            // Arrange.
            var cosmeticFactory = new CosmeticsFactory();

            // Act & Assert.
            Assert.Throws <NullReferenceException>(() => cosmeticFactory.CreateCategory(nameParam));
        }
        public void ThrowNullRefException_WhenThePassedNameParamIsNullOrEmpty(string name)
        {
            //Arrange
            var factory = new CosmeticsFactory();

            // Act & Assert
            Assert.Throws <NullReferenceException>(() => factory.CreateCategory(name));
        }
        public void CreateCategory_WhenNameParamLenghtIsOutOfRange_ShouldThrowIndexOutOfRangeException(string nameParam)
        {
            // Arrange.
            var cosmeticFactory = new CosmeticsFactory();

            // Act & Assert.
            Assert.Throws <IndexOutOfRangeException>(() => cosmeticFactory.CreateCategory(nameParam));
        }
Esempio n. 6
0
        public void CreateCategory_ShouldThrowIndexOutOfRangeException_IfNameLengthIsOutOfRange(string name)
        {
            //Arrange
            var cosmeticsFactory = new CosmeticsFactory();

            //Act and Assert
            Assert.Throws <IndexOutOfRangeException>(() => cosmeticsFactory.CreateCategory(name));
        }
        public void CreateCategory_WhenCreateCategoryIsCalled()
        {
            var factory = new CosmeticsFactory();

            var category = factory.CreateCategory("Pesho");

            Assert.IsInstanceOf(typeof(Category), category);
        }
        public void ThrowIndexOutOfRangeException_WhenPasedNameLengthIsInvalid(string name)
        {
            // arrange
            var factory = new CosmeticsFactory();

            // act and assert
            Assert.Throws <IndexOutOfRangeException>(() => factory.CreateCategory(name));
        }
        public void TestCreateCategory_PassValidParameters_ShouldCreateCategory(string name)
        {
            var factory  = new CosmeticsFactory();
            var category = factory.CreateCategory(name);

            Assert.IsNotNull(category);
            Assert.IsTrue(category.Name == name);
            Assert.IsTrue(category.GetType().Name == "Category");
        }
Esempio n. 10
0
        public void CreateCategory_ShouldThrowIndexOutOfRangeException_WhenPassedTooShortNameParameter()
        {
            // Arrange
            string name = "2";

            var factory = new CosmeticsFactory();

            // Act & Assert
            Assert.Throws <IndexOutOfRangeException>(() => factory.CreateCategory(name));
        }
Esempio n. 11
0
        public void CreateCategory_ShouldThrowIndexOutOfRangeException_WhenPassedTooLongNameParameter()
        {
            // Arrange
            string name = "ANameThatIsOverFifteenCharachtersLong";

            var factory = new CosmeticsFactory();

            // Act & Assert
            Assert.Throws <IndexOutOfRangeException>(() => factory.CreateCategory(name));
        }
Esempio n. 12
0
        public void CreateCategory_ShouldThrowNullReferenceException_WhenPassedEmptyNameParameter()
        {
            // Arrange
            string name = string.Empty;

            var factory = new CosmeticsFactory();

            // Act & Assert
            Assert.Throws <NullReferenceException>(() => factory.CreateCategory(name));
        }
        public void ReturnShampooInstance_WhenInputParamsAreValid()
        {
            //Arrange
            var factory = new CosmeticsFactory();

            // Act
            var category = factory.CreateCategory("bokluk");

            // Assert
            Assert.IsInstanceOf <Category>(category);
        }
        public void CreateCategory_WhenNameParamIsValid_ShouldReturnInstanceOfCategory()
        {
            // Arrange
            var cosmeticFactory = new CosmeticsFactory();

            // Act
            var executionResult = cosmeticFactory.CreateCategory("Pesho");

            // Assert
            Assert.IsInstanceOf <ICategory>(executionResult);
        }
Esempio n. 15
0
        public void CreateCategory_ShouldReturnNewCategory_IfAllParamsAreValid()
        {
            //Arrange
            var cosmeticsFactory = new CosmeticsFactory();

            //Act
            var category = cosmeticsFactory.CreateCategory(name);

            //Assert
            Assert.IsInstanceOf <Category>(category);
        }
        public void CreateCategory_WhenNameParamIsValid_ShouldReturnInstanceOfCategory()
        {
            // Arrange.
            var cosmeticFactory = new CosmeticsFactory();

            // Act.
            var actualFactory = cosmeticFactory.CreateCategory("Pesho");

            // Assert.
            Assert.IsInstanceOf <ICategory>(actualFactory);
        }
Esempio n. 17
0
        public void CreateCategory_ShouldReturnAnInstanceOfACategory_WhenPassedValidParameters()
        {
            // Arrange
            string name = "Valid";

            var factory = new CosmeticsFactory();

            // Act
            var shampooResult = factory.CreateCategory(name);

            // Assert
            Assert.IsInstanceOf <ICategory>(shampooResult);
        }
        public void TestCreateCategory_PassLongerName_ShouldTHrowIndexOutOfRange(string name)
        {
            var factory = new CosmeticsFactory();

            Assert.Throws <IndexOutOfRangeException>(() => factory.CreateCategory(name));
        }
Esempio n. 19
0
 public void TestCreateCategory_PassNullForName_ShouldThrowNullReference()
 {
     Assert.Throws <NullReferenceException>(() => factory.CreateCategory(null));
 }