public void TwoDependencyTest() { //Arrange ServiceCollection serviceCollection = new ServiceCollection(); MockInjectingServiceProvider target = serviceCollection.BuildMockInjectingServiceProvider(); //Act TwoDependency service = target.GetRequiredService <TwoDependency>(); //Assert Assert.AreEqual(target.GetMock <ISomeInterface>().Object, service.SomeInterface); Assert.AreEqual(target.GetMock <ISomeOtherInterface>().Object, service.SomeOtherInterface); }
public void OneConfiguredDependency() { //Arrange ServiceCollection serviceCollection = new ServiceCollection(); SomeClass someClass = new SomeClass(); serviceCollection.AddSingleton <ISomeInterface>(someClass); MockInjectingServiceProvider target = serviceCollection.BuildMockInjectingServiceProvider(); //Act TwoDependency service = target.GetRequiredService <TwoDependency>(); //Assert Assert.AreEqual(someClass, service.SomeInterface); Assert.AreEqual(target.GetMock <ISomeOtherInterface>().Object, service.SomeOtherInterface); }