public void GetNameParserAndParseStringName_Success()
        {
            Dictionary <string, string> env = new Dictionary <string, string>();

            env.Add(Context.INITIAL_CONTEXT_FACTORY, "Java2NetPort.JNDI.ServiceProviders.InMemoryServiceProvider.InitialInMemoryContextFactory");

            IContext ctx = new InitialContext(env);

            INameParser np = ctx.GetNameParser("");

            Assert.IsNotNull(np);

            Assert.IsTrue(np is InMemoryHierarchicalNameParser);

            IName n = np.Parse("itemA;itemB;itemC");

            IEnumerable <string> r          = n.GetAll();
            IEnumerator <string> enumerator = r.GetEnumerator();

            enumerator.MoveNext();
            Assert.AreEqual("itemA", enumerator.Current);

            enumerator.MoveNext();
            Assert.AreEqual("itemB", enumerator.Current);

            enumerator.MoveNext();
            Assert.AreEqual("itemC", enumerator.Current);

            Assert.IsFalse(enumerator.MoveNext());
        }
        public void remove_Success()
        {
            Dictionary <string, string> env = new Dictionary <string, string>();

            env.Add(Context.INITIAL_CONTEXT_FACTORY, "Java2NetPort.JNDI.ServiceProviders.InMemoryServiceProvider.InitialInMemoryContextFactory");

            IContext ctx = new InitialContext(env);

            INameParser np = ctx.GetNameParser("");

            IName n = np.Parse("item1;item2;item3");

            string rez = n.Remove(1);

            Assert.AreEqual("item2", rez);

            IEnumerable <string> r          = n.GetAll();
            IEnumerator <string> enumerator = r.GetEnumerator();

            enumerator.MoveNext();
            Assert.AreEqual("item1", enumerator.Current);

            enumerator.MoveNext();
            Assert.AreEqual("item3", enumerator.Current);


            Assert.IsFalse(enumerator.MoveNext());
        }
        public void LookupEmptyName_ShouldReturnContext()
        {
            Dictionary <string, string> env = new Dictionary <string, string>();

            env.Add(Context.INITIAL_CONTEXT_FACTORY, "Java2NetPort.JNDI.ServiceProviders.InMemoryServiceProvider.InitialInMemoryContextFactory");

            IContext    ctx = new InitialContext(env);
            INameParser np  = ctx.GetNameParser(string.Empty);

            IName name = np.Parse("");

            object result = ctx.Lookup(name);

            Assert.IsTrue(result is IContext);
            Assert.IsTrue(result is InMemoryNamingServiceProvider);
        }