Ejemplo n.º 1
0
        public void Location()
        {
            LocationFilter filter = new LocationFilter("Enterprise.Site", true);

            Assert.That(filter.Location, Is.EqualTo("Enterprise.Site"));

            Assert.That(filter.WithRecurse, Is.True);
        }
Ejemplo n.º 2
0
        public void NullTryParse()
        {
            LocationFilter filter;

            bool result = LocationFilter.TryParse(null, out filter);

            Assert.That(filter, Is.Null);
            Assert.That(result, Is.EqualTo(false));
        }
Ejemplo n.º 3
0
        public void Filter()
        {
            LocationFilter filter = new LocationFilter("Enterprise.Site", true);

            Assert.That(filter.Filter, Is.EqualTo("Enterprise.Site with recurse"));

            filter = new LocationFilter("Enterprise.Site", false);
            Assert.That(filter.Filter, Is.EqualTo("Enterprise.Site"));
        }
Ejemplo n.º 4
0
        public void WithRecurse()
        {
            LocationFilter filter = new LocationFilter("Enterprise.Site", true);

            Assert.That(filter.WithRecurse, Is.True);

            filter = new LocationFilter("Enterprise.Site", false);
            Assert.That(filter.WithRecurse, Is.False);
        }
Ejemplo n.º 5
0
        public void TryParseShortName()
        {
            LocationFilter filter;

            bool result = LocationFilter.TryParse("A.B", out filter);

            Assert.That(filter.Location, Is.EqualTo("A.B"));
            Assert.That(filter.WithRecurse, Is.EqualTo(false));
            Assert.That(result, Is.EqualTo(true));
        }
Ejemplo n.º 6
0
        public void TryParse()
        {
            LocationFilter filter;

            bool result = LocationFilter.TryParse("Enterprise.Site", out filter);

            Assert.That(filter.Location, Is.EqualTo("Enterprise.Site"));
            Assert.That(filter.WithRecurse, Is.EqualTo(false));
            Assert.That(result, Is.EqualTo(true));
        }
Ejemplo n.º 7
0
        public static bool TryParse(string locationFilter, out LocationFilter filter)
        {
            if (!string.IsNullOrEmpty(locationFilter))
            {
                string location    = locationFilter;
                bool   withRecurse = false;
                if (locationFilter.EndsWith(" with recurse", StringComparison.InvariantCultureIgnoreCase))
                {
                    int withRecurseLenth = " with recurse".Length;
                    if (locationFilter.Length > withRecurseLenth)
                    {
                        location    = locationFilter.Substring(0, locationFilter.Length - withRecurseLenth);
                        withRecurse = true;
                    }
                }
                filter = new LocationFilter(location, withRecurse);
                return(true);
            }

            filter = null;
            return(false);
        }