Exemplo n.º 1
0
  @Test
  public void registerInstance() throws Exception {
    Bar b = new Bar();
    c.RegisterInstance(b);
    Bar r1 = c.Resolve(Bar.class);
    Bar r2 = c.Resolve(Bar.class);
    assertSame(r1, r2);
    assertSame(b, r1);

    c.RegisterType(Bar.class, false);
    Bar r3 = c.Resolve(Bar.class);
    assertNotSame(r1, r3);
  }
Exemplo n.º 2
0
 @Test
 public void registeredStringConstructor() throws Exception {
   c.RegisterInstance("ala ma kota");
   X x = c.Resolve(X.class);
   assertEquals("ala ma kota", x.s);
 }