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

            // Act && Assert
            Assert.Throws<NullReferenceException>(() => cosmeticFactory.CreateCategory(nameParam));
        }
Пример #2
0
        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");
        }
        public void CreateCategory_WhenNameParamIsValid_ShouldReturnInstanceOfCategory()
        {
            // Arrange
            var cosmeticFactory = new CosmeticsFactory();

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

            // Assert
            Assert.IsInstanceOf<ICategory>(executionResult);
        }
Пример #4
0
        public void TestCreateCategory_PassLongerName_ShouldTHrowIndexOutOfRange(string name)
        {
            var factory = new CosmeticsFactory();

            Assert.Throws<IndexOutOfRangeException>(() => factory.CreateCategory(name));
        }