public void LookupWithExpectedTypeAndMatch() { JndiLookupFactoryObject jfo = new JndiLookupFactoryObject(); string s = ""; jfo.JndiLookupContext = new ExpectedLookupContext("foo", s); jfo.JndiName = "foo"; jfo.ExpectedType = typeof (string); jfo.AfterPropertiesSet(); Assert.AreEqual(s, jfo.GetObject()); }
public void LookupWithDefaultObjectAndExpectedTypeNoMatch() { JndiLookupFactoryObject jfo = new JndiLookupFactoryObject(); string s = ""; jfo.JndiLookupContext = new ExpectedLookupContext("foo", s); jfo.JndiName = "myFoo"; jfo.ExpectedType = typeof(string); jfo.DefaultObject = true; jfo.AfterPropertiesSet(); }
public void LookupWithExpectedTypeAndMatch() { JndiLookupFactoryObject jfo = new JndiLookupFactoryObject(); string s = ""; jfo.JndiLookupContext = new ExpectedLookupContext("foo", s); jfo.JndiName = "foo"; jfo.ExpectedType = typeof(string); jfo.AfterPropertiesSet(); Assert.AreEqual(s, jfo.GetObject()); }
public void LookupWithDefaultObjectAndExpectedType() { JndiLookupFactoryObject jfo = new JndiLookupFactoryObject(); string s = ""; jfo.JndiLookupContext = new ExpectedLookupContext("foo", s); jfo.JndiName = "myFoo"; jfo.ExpectedType = typeof (string); jfo.DefaultObject = "myString"; jfo.AfterPropertiesSet(); Assert.AreEqual("myString", jfo.GetObject()); }
public void LookupWithDefaultObjectAndExpectedType() { JndiLookupFactoryObject jfo = new JndiLookupFactoryObject(); string s = ""; jfo.JndiLookupContext = new ExpectedLookupContext("foo", s); jfo.JndiName = "myFoo"; jfo.ExpectedType = typeof(string); jfo.DefaultObject = "myString"; jfo.AfterPropertiesSet(); Assert.AreEqual("myString", jfo.GetObject()); }
public void LookupWithExpectedTypeAndNoMatch() { JndiLookupFactoryObject jfo = new JndiLookupFactoryObject(); object o = new object(); jfo.JndiLookupContext = new ExpectedLookupContext("foo", o); jfo.JndiName = "foo"; jfo.ExpectedType = typeof (string); try { jfo.AfterPropertiesSet(); Assert.Fail("Should have thrown NamingException"); } catch (NamingException ex) { Assert.True(ex.Message.IndexOf("is not assignable to [String]") != -1); } }
public void LookupWithExpectedTypeAndNoMatch() { JndiLookupFactoryObject jfo = new JndiLookupFactoryObject(); object o = new object(); jfo.JndiLookupContext = new ExpectedLookupContext("foo", o); jfo.JndiName = "foo"; jfo.ExpectedType = typeof(string); try { jfo.AfterPropertiesSet(); Assert.Fail("Should have thrown NamingException"); } catch (NamingException ex) { Assert.True(ex.Message.IndexOf("is not assignable to [String]") != -1); } }
public void NoJndiName() { JndiLookupFactoryObject jfo = new JndiLookupFactoryObject(); jfo.AfterPropertiesSet(); }