Exemple #1
0
        //[Fact]
        public void ServiceInstanceCanBeResolved()
        {
            // Arrange
            var collection = new ServiceCollection();
            var instance   = new FakeService();

            collection.AddSingleton(typeof(IFakeServiceInstance), instance.GetType());
            var provider = CreateServiceProvider(collection);

            // Act
            var service = provider.GetService <IFakeServiceInstance>();

            // Assert
            Assert.Same(instance, service);
        }