Beispiel #1
0
        public void Test_NotValidWhenHostLengthIsLessThanFive()
        {
            // Arrange
            var host = HostValidatorHelper.GetValidRequestDto();

            host.Host = "o.ru";

            // Assert
            Assert.IsFalse(_validator.Validate(host).IsValid);
        }
Beispiel #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="GridionClientConfiguration" /> class.
        /// </summary>
        /// <param name="host">
        ///     The IP address.
        /// </param>
        /// <param name="port">
        ///     The port on the address.
        /// </param>
        internal GridionClientConfiguration(string host, int port)
        {
            HostValidator.Validate(host, port);

            this.Host = host;
            this.Port = port;
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="GridionServerConfiguration" /> class.
        /// </summary>
        /// <param name="host">
        ///     The IP address.
        /// </param>
        /// <param name="port">
        ///     The port.
        /// </param>
        internal GridionServerConfiguration(string host, int port)
        {
            HostValidator.Validate(host, port);

            this.Logger = new ConsoleLogger();
            this.Host   = host;
            this.Port   = port;
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="GridionServerConfiguration" /> class.
        /// </summary>
        /// <param name="logger">
        ///     The logger to log internal operations.
        /// </param>
        /// <param name="host">
        ///     The IP address.
        /// </param>
        /// <param name="port">
        ///     The port.
        /// </param>
        /// <inheritdoc cref="GridionServerConfiguration" />
        internal GridionServerConfiguration(ILogger logger, string host, int port)
            : this(host, port)
        {
            Should.NotBeNull(logger, nameof(logger));
            HostValidator.Validate(host, port);

            this.Logger = logger;
        }
Beispiel #5
0
        /// <inheritdoc cref="IPEndPoint" />
        private GridionEndpoint(string host, int port)
            : base(IPAddress.Parse(host), port)
        {
            HostValidator.Validate(host, port);

            this.Host = host;
            this.Port = port;
        }
        public void Test_NotValidWhenPortIsNotExist()
        {
            // Arrange
            var host = HostValidatorHelper.GetValidRequestDto();

            host.Port = -10;

            // Assert
            Assert.IsFalse(_validator.Validate(host).IsValid);
        }
        public void Test_NotValidWhenDelayIsNegative()
        {
            // Arrange
            var host = HostValidatorHelper.GetValidRequestDto();

            host.DelayInMilliseconds = -10;

            // Assert
            Assert.IsFalse(_validator.Validate(host).IsValid);
        }
        private CustomerServices GetService()
        {
            CustomerServices services       = new CustomerServices();
            Uri               uri           = new Uri(services.Url);
            string            dnsName       = uri.DnsSafeHost;
            HostValidator     hostValidator = new HostValidator();
            ValidationResults r             = hostValidator.Validate(dnsName);

            if (r.IsValid)
            {
                return(services);
            }
            else
            {
                throw new Exception("Unable to save at this time");
            }
        }
Beispiel #9
0
 /// <inheritdoc />
 void IGridionClient.Connect(string host, int port)
 {
     HostValidator.Validate(host, port);
     this.IsConnected = true;
 }
Beispiel #10
0
 internal void Validate()
 {
     HostValidator.Validate(this.Host, this.Port);
 }