Ejemplo n.º 1
0
        public void GivenProduct_WhenTheNameIsEmpty_IsFailed()
        {
            // Arrange
            var product = new Product(null, 10);
            var spec    = new IsNameMaxLengthValidSpec();

            // Act
            var result = spec.IsSatisfiedBy(product);

            // Assert
            Assert.False(result);
        }
Ejemplo n.º 2
0
        public void GivenProduct_WhenTheNameIsMoreThanLimit_IsFailed()
        {
            // Arrange
            var product = new Product(new string('c', 300), 10);
            var spec    = new IsNameMaxLengthValidSpec();

            // Act
            var result = spec.IsSatisfiedBy(product);

            // Assert
            Assert.False(result);
        }
Ejemplo n.º 3
0
        public void GivenProduct_WhenTheNameIsValid_IsSuccessful()
        {
            // Arrange
            var product = new Product("dammy name", 10);
            var spec    = new IsNameMaxLengthValidSpec();

            // Act
            var result = spec.IsSatisfiedBy(product);

            // Assert
            Assert.True(result);
        }