public void Can_parse_host_values()
		{
			var store = new Store()
			{
				Hosts = "yourstore.com, www.yourstore.com, "
			};

			var hosts = store.ParseHostValues();
			hosts.Length.ShouldEqual(2);
			hosts[0].ShouldEqual("yourstore.com");
			hosts[1].ShouldEqual("www.yourstore.com");
		}
Пример #2
0
        /// <summary>
        /// Indicates whether a store contains a specified host
        /// </summary>
        /// <param name="store">Store</param>
        /// <param name="host">Host</param>
        /// <returns>true - contains, false - no</returns>
        public static bool ContainsHostValue(this Store store, string host)
        {
            Guard.NotNull(store, nameof(store));

            if (string.IsNullOrEmpty(host))
            {
                return(false);
            }

            var contains = store.ParseHostValues()
                           .FirstOrDefault(x => x.Equals(host, StringComparison.InvariantCultureIgnoreCase)) != null;

            return(contains);
        }
Пример #3
0
        /// <summary>
        /// Indicates whether a store contains a specified host
        /// </summary>
        /// <param name="store">Store</param>
        /// <param name="host">Host</param>
        /// <returns>true - contains, false - no</returns>
        public static bool ContainsHostValue(this Store store, string host)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }

            if (String.IsNullOrEmpty(host))
            {
                return(false);
            }

            var contains = store.ParseHostValues()
                           .FirstOrDefault(x => x.Equals(host, StringComparison.InvariantCultureIgnoreCase)) != null;

            return(contains);
        }