public void Should_return_a_notification_when_creating_a_new_brand_and_brand_name_is_null()
        {
            var brandCommand = new BrandCommand();

            Assert.IsFalse(brandCommand.IsValid());
            Assert.IsTrue(brandCommand.Notifications.ToList().Any(n => n.Property.Contains(nameof(brandCommand.Name))));
        }
Example #2
0
        public void Should_contain_a_notification_when_creating_a_new_brand_and_brand_name_is_null()
        {
            var brandCommand = new BrandCommand();

            brandCommand.IsValid();

            brandCommand.Notifications.ToList().Should().Contain(n => n.Property.Contains(nameof(brandCommand.Name)));
        }
        public void Should_return_a_notification_when_creating_a_new_brand_with_a_brand_name_greater_than_the_maximum_allowed_size()
        {
            var brandCommand = new BrandCommand {
                Name = this.MockString(Brand.MAXIMUM_NAME_SIZE + 1)
            };

            Assert.IsFalse(brandCommand.IsValid());
            Assert.IsTrue(brandCommand.Notifications.ToList().Any(n => n.Property.Contains(nameof(brandCommand.Name))));
        }
Example #4
0
        public void Should_contain_a_notification_when_creating_a_new_brand_with_a_brand_name_lower_than_the_minimum_allowed_size()
        {
            var brandCommand = new BrandCommand {
                Name = this.MockString(Brand.MINIMUM_NAME_SIZE - 1)
            };

            brandCommand.IsValid();

            brandCommand.Notifications.ToList().Should().Contain(n => n.Property.Contains(nameof(brandCommand.Name)));
        }
Example #5
0
        public void Should_not_contain_notifications_when_creating_a_new_brand_with_valid_requides_properties()
        {
            var brandCommand = new BrandCommand {
                Name = this.MockString(Brand.MINIMUM_NAME_SIZE)
            };

            brandCommand.IsValid();

            brandCommand.Notifications.ToList().Should().BeEmpty();
        }
        public void Should_return_true_when_creating_a_new_brand_with_a_brand_name_between_min_and_max_size()
        {
            var brandNameSize = new Random().Next(Brand.MINIMUM_NAME_SIZE, Brand.MAXIMUM_NAME_SIZE);
            var brandCommand  = new BrandCommand {
                Name = this.MockString(brandNameSize)
            };

            Assert.IsTrue(brandCommand.IsValid());
            Assert.IsFalse(brandCommand.Notifications.ToList().Any());
        }