Cucumber.SimpleDb.Transport.SimpleDbRestService.CreateDomain C# (CSharp) Method

CreateDomain() public method

public CreateDomain ( string domain ) : System.Xml.Linq.XElement
domain string
return System.Xml.Linq.XElement
        public XElement CreateDomain(string domain)
        {
            if(IsValidDomainName(domain) == false)
            {
                throw new FormatException(
                    string.Format("'{0}' is not a valid domain name\n\nDomain names must be between 3 and 255 characters, and contain only a-z, A-Z, 0-9, and _, - and .",
                        domain));
            }
            var values = new NameValueCollection
            {
                {"Action", "CreateDomain"},
                {"DomainName", domain}
            };
            return InternalExecute(values);
        }

Usage Example

 public void TestCreateInvalidDomainNameTooLong()
 {
     var domainName = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
     var service = new SimpleDbRestService(new PassThroughAwsRestService ());
     var exception = Assert.Catch(() =>
         {
             service.CreateDomain(domainName);
         });
     Assert.IsInstanceOf<FormatException>(exception);
 }
All Usage Examples Of Cucumber.SimpleDb.Transport.SimpleDbRestService::CreateDomain