예제 #1
0
        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);
        }
예제 #2
0
        public void WhenRepoRegisteredThenGetInstance()
        {
            var factory = new GenericRepositoryFactory();

            factory.RegisterTransient <IMyRepo>(x => new MyRepo());
            var actual = factory.GetRepository <IMyRepo>();

            actual.Should().Be.OfType <MyRepo>();
        }