Esempio n. 1
0
        public void Should_be_invalid_when_site_domain_is_empty()
        {
            var command = new CreateCommerceCommand
            {
                SiteDomain = ""
            };

            command.Validate();

            Assert.True(command.Invalid);
            Assert.Equal("SiteDomain", command.Notifications
                         .Select(x => x.Property)
                         .FirstOrDefault(x => x == "SiteDomain"));
        }
Esempio n. 2
0
        public void Should_be_invalid_when_name_surpass_max_length_50_chars()
        {
            var command = new CreateCommerceCommand
            {
                Name = new string('a', 51)
            };

            command.Validate();

            Assert.True(command.Invalid);
            Assert.Equal("Name", command.Notifications
                         .Select(x => x.Property)
                         .FirstOrDefault(x => x == "Name"));
        }
Esempio n. 3
0
        public void Should_be_invalid_when_name_does_not_has_min_length_3_chars()
        {
            var command = new CreateCommerceCommand
            {
                Name = "a"
            };

            command.Validate();

            Assert.True(command.Invalid);
            Assert.Equal("Name", command.Notifications
                         .Select(x => x.Property)
                         .FirstOrDefault(x => x == "Name"));
        }
Esempio n. 4
0
        public void Should_be_invalid_when_name_is_null()
        {
            var command = new CreateCommerceCommand
            {
                Name = null
            };

            command.Validate();

            Assert.True(command.Invalid);
            Assert.Equal("Name", command.Notifications
                         .Select(x => x.Property)
                         .FirstOrDefault(x => x == "Name"));
        }
Esempio n. 5
0
        public void Should_be_invalid_when_city_is_empty()
        {
            var command = new CreateCommerceCommand
            {
                City = ""
            };

            command.Validate();

            Assert.True(command.Invalid);
            Assert.Equal("City", command.Notifications
                         .Select(x => x.Property)
                         .FirstOrDefault(x => x == "City"));
        }
Esempio n. 6
0
        public void Should_be_valid()
        {
            var command = new CreateCommerceCommand
            {
                Name       = _valid_name,
                SiteDomain = _valid_domain,
                Country    = _valid_country,
                State      = _valid_state,
                City       = _valid_city
            };

            command.Validate();

            Assert.True(command.Valid);
        }