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")); }
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")); }
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")); }
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")); }
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")); }
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); }