public void CreateShampoo_WhenNameParamIsNullOrEmpty_ShouldThrowNullReferenceException(string nameParam) { // Arrange var cosmeticFactory = new CosmeticsFactory(); // Act && Assert Assert.Throws<NullReferenceException>(() => cosmeticFactory.CreateShampoo(nameParam, "example", 10.0M, GenderType.Men, 100, UsageType.EveryDay)); }
public void CreateShampoo_WhenBrandParamLenghtIsOutOfRange_ShouldThrowIndexOutOfRangeException(string brandParam) { // Arrange var cosmeticFactory = new CosmeticsFactory(); // Act && Assert Assert.Throws<IndexOutOfRangeException>(() => cosmeticFactory.CreateShampoo("example", brandParam, 10.0M, GenderType.Men, 100, UsageType.EveryDay)); }
public void TestCreateShampoo_PassValidParameters_ShouldCreateShampoo(string name, string brand) { var factory = new CosmeticsFactory(); var shampoo = factory.CreateShampoo(name, brand, 10.0M, GenderType.Men, 100, UsageType.EveryDay); Assert.IsNotNull(shampoo); Assert.IsTrue(shampoo.Name == name); Assert.IsTrue(shampoo.Brand == brand); }
public void CreateShampoo_WhenAllParamsAreValid_ShouldReturnInstanceOfShampoo() { // Arrange var cosmeticFactory = new CosmeticsFactory(); // Act var executionResult = cosmeticFactory.CreateShampoo("Pesho", "example", 10.0M, GenderType.Men, 100, UsageType.EveryDay); // Assert Assert.IsInstanceOf<IShampoo>(executionResult); }
public void TestCreateShampoo_PassLongerName_ShouldTHrowIndexOutOfRange(string name) { var factory = new CosmeticsFactory(); Assert.Throws<IndexOutOfRangeException>(() => factory.CreateShampoo(name, "example", 10.0M, GenderType.Men, 100, UsageType.EveryDay)); }
public void TestCreateShampoo_PassInvalidName_ShouldTHrowNullReferenceException(string name) { var factory = new CosmeticsFactory(); Assert.Throws<NullReferenceException>(() => factory.CreateShampoo(name, "example", 10.0M, GenderType.Men, 100, UsageType.EveryDay)); }