public void WhenRepoRegisteredAsSingletonThenGetSameInstance() { var factory = new GenericRepositoryFactory(); factory.RegisterSingleton <IMyRepo>(x => new MyRepo()); var first = factory.GetRepository <IMyRepo>(); var actual = factory.GetRepository <IMyRepo>(); actual.Should().Be.SameInstanceAs(first); }
public void WhenRepoRegisteredThenGetInstance() { var factory = new GenericRepositoryFactory(); factory.RegisterTransient <IMyRepo>(x => new MyRepo()); var actual = factory.GetRepository <IMyRepo>(); actual.Should().Be.OfType <MyRepo>(); }