public void ThrowIndexOutOfRangeException_WhenThePassedBrandParamLengthIsOutOfThePermittedRange(string name) { //Arrange var factory = new CosmeticsFactory(); // Act & Assert Assert.Throws <IndexOutOfRangeException>(() => factory.CreateShampoo(name, "brand", 2.1m, 0, 200, 0)); }
public void CreateShampoo_WhenCreateShampooIsCalled() { var factory = new CosmeticsFactory(); var shampoo = factory.CreateShampoo("Pesho", "Nivea", 2.50m, GenderType.Men, 500, UsageType.EveryDay); Assert.IsInstanceOf(typeof(Shampoo), shampoo); }
public void ThrowNullRefException_WhenThePassedBrandParamIsNullOrEmpty(string name) { //Arrange var factory = new CosmeticsFactory(); // Act & Assert Assert.Throws <NullReferenceException>(() => factory.CreateShampoo(name, "brand", 2.1m, 0, 200, 0)); }
public void CreateShampoo_WhenBrandParamLenghtIsOutOfRange_ShouldThrowIndexOutOfRangeException(string brandParam) { // Arrange. var cosmeticFactory = new CosmeticsFactory(); // Act & Assert. Assert.Throws <IndexOutOfRangeException>(() => cosmeticFactory.CreateShampoo("example", brandParam, 10.0M, GenderType.Unisex, 100, UsageType.Medical)); }
public void CreateShampoo_WhenBrandParamIsNullOrEmpty_ShouldThrowNullReferenceException(string brandParam) { // Arrange. var cosmeticFactory = new CosmeticsFactory(); // Act & Assert. Assert.Throws <NullReferenceException>(() => cosmeticFactory.CreateShampoo("example", brandParam, 10.0M, GenderType.Unisex, 100, UsageType.Medical)); }
public void CreateShampoo_WhenNameParamLenghtIsOutOfRange_ShouldThrowIndexOutOfRangeException(string nameParam) { // Arrange var cosmeticFactory = new CosmeticsFactory(); // Act && Assert Assert.Throws <IndexOutOfRangeException>(() => cosmeticFactory.CreateShampoo(nameParam, "example", 10.0M, GenderType.Men, 100, UsageType.EveryDay)); }
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 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_ShouldThrowNullReferenceException_IfNameOrBrandIsInvalid(string name, string brand) { //Arrange var cosmeticsFactory = new CosmeticsFactory(); //Act and Assert Assert.Throws <NullReferenceException>(() => cosmeticsFactory.CreateShampoo(name, brand, price, gender, milliliters, usage)); }
public void CreateShampoo_ShouldThrowIndexOutOfRangeException_IfNameOrBrandLengthIsOutOfRange (string name, string brand) { //Arrange var cosmeticsFactory = new CosmeticsFactory(); //Act and Assert Assert.Throws <IndexOutOfRangeException>(() => cosmeticsFactory.CreateShampoo(name, brand, price, gender, milliliters, usage)); }
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 ReturnShampooInstance_WhenInputParamsAreValid() { //Arrange var factory = new CosmeticsFactory(); // Act var shampoo = factory.CreateShampoo("bokluk", "brand", 2.1m, 0, 200, 0); // Assert Assert.IsInstanceOf <Shampoo>(shampoo); }
public void ReturnInstanceOfTypeProduct() { // Arrange, Act, Assert var factory = new CosmeticsFactory(); // Act var product = factory.CreateShampoo("name", "brand", 10, GenderType.Unisex, 10, UsageType.EveryDay); // Assert Assert.IsInstanceOfType(product, typeof(IProduct)); }
public void CreateShampoo_WhenAllParamsAreValid_ShouldReturnInstanceOfShampoo() { // Assert. var cosmeticFactory = new CosmeticsFactory(); // Act. var actualFactory = cosmeticFactory.CreateShampoo("nameEx", "brandEx", 10.0M, GenderType.Unisex, 100, UsageType.Medical); // Assert. Assert.IsInstanceOf <IShampoo>(actualFactory); }
public void CreateShampoo_ShouldReturnNewShampoo_IfAllParamsAreValid() { //Arrange var cosmeticsFactory = new CosmeticsFactory(); //Act var shampoo = cosmeticsFactory.CreateShampoo(name, brand, price, gender, milliliters, usage); //Act Assert.IsInstanceOf <Shampoo>(shampoo); }
public void ThrowNullReferenceException_WhenPassedBrandIsNullOrEmpty(string brand) { // arrange string name = "someName"; decimal price = 20; var gender = GenderType.Men; uint milliliters = 500; var usage = UsageType.EveryDay; var factory = new CosmeticsFactory(); // act and assert Assert.Throws <NullReferenceException>( () => factory.CreateShampoo(name, brand, price, gender, milliliters, usage)); }
public void ThrowIndexOutOfRangeException_WhenPassedBrandHasInvalidLength(string brand) { // arrange string name = "someName"; decimal price = 20; var gender = GenderType.Men; uint milliliters = 500; var usage = UsageType.EveryDay; var factory = new CosmeticsFactory(); // act and assert Assert.Throws <IndexOutOfRangeException>( () => factory.CreateShampoo(name, brand, price, gender, milliliters, usage)); }
public void ReturnNewShampoo_WhenThePAssedParametersAreAllValiid() { // arrange string name = "someName"; string brand = "someBrand"; decimal price = 20; var gender = GenderType.Men; uint milliliters = 500; var usage = UsageType.EveryDay; var factory = new CosmeticsFactory(); // act var returendObj = factory.CreateShampoo(name, brand, price, gender, milliliters, usage); // assert Assert.IsInstanceOf <Shampoo>(returendObj); }
public void CreateShampoo_ShouldReturnAnInstanceOfAShampoo_WhenPassedValidParameters() { // Arrange string name = "Shamdoo", brand = "Brand"; decimal price = 123.45m; var gender = GenderType.Unisex; uint milliliters = 200; var usage = UsageType.EveryDay; var factory = new CosmeticsFactory(); // Act var shampooResult = factory.CreateShampoo(name, brand, price, gender, milliliters, usage); // Assert Assert.IsInstanceOf <IShampoo>(shampooResult); }
public void CreateShampoo_ShouldThrowIndexOutOfRangeException_WhenPassedTooShortNameParameter() { // Arrange string name = "Hi", brand = "Brand"; decimal price = 123.45m; var gender = GenderType.Unisex; uint milliliters = 200; var usage = UsageType.EveryDay; var factory = new CosmeticsFactory(); // Act var exc = Assert.Throws <IndexOutOfRangeException>(() => factory.CreateShampoo(name, brand, price, gender, milliliters, usage)); // Assert StringAssert.Contains("Product name", exc.Message); }
public void CreateShampoo_ShouldThrowNullReferenceException_WhenPassedNullBrandParameter() { // Arrange string name = "Shampoo", brand = null; decimal price = 123.45m; var gender = GenderType.Unisex; uint milliliters = 200; var usage = UsageType.EveryDay; var factory = new CosmeticsFactory(); // Act var exc = Assert.Throws <NullReferenceException>(() => factory.CreateShampoo(name, brand, price, gender, milliliters, usage)); // Assert StringAssert.Contains("Product brand", exc.Message); }
public void ReturnAStringWithTheShampooDetailsInTheCorrectFormat() { // Arrange var factory = new CosmeticsFactory(); var shampoo = factory.CreateShampoo("name", "brand", 2.1m, 0, 200, 0); var expectedResult = new StringBuilder(); expectedResult.AppendLine("- brand - name:"); expectedResult.AppendLine(" * Price: $420.0"); expectedResult.AppendLine(" * For gender: Men"); expectedResult.AppendLine(" * Quantity: 200 ml"); expectedResult.Append(" * Usage: EveryDay"); // Act var message = shampoo.Print(); // Assert Assert.AreEqual(expectedResult.ToString(), message); }
public void CreateShampoo_PassNullAsName_ShouldThrowArgumentNull() { Assert.Throws <NullReferenceException>(() => factory.CreateShampoo(null, brand, price, gender, 100, UsageType.EveryDay)); }
public void TestCreateShampoo_PassLongerBrand_ShouldTHrowIndexOutOfRange(string brand) { var factory = new CosmeticsFactory(); Assert.Throws <IndexOutOfRangeException>(() => factory.CreateShampoo("example", brand, 10.0M, GenderType.Men, 100, UsageType.EveryDay)); }
public void TestCreateShampoo_PassInvalidBrand_ShouldTHrowNullReferenceException(string brand) { var factory = new CosmeticsFactory(); Assert.Throws <NullReferenceException>(() => factory.CreateShampoo("example", brand, 10.0M, GenderType.Men, 100, UsageType.EveryDay)); }