public void Should_resolve_all_instances_using_ResolveAll_with_type() { // Arrange var expectedInstance = new DefaultWhatDoIHaveBuilder(); FakeIoC.Reset(); FakeIoC.GetAllInstancesProvider = () => new List <object> { expectedInstance }; SecurityConfigurator.Configure(configuration => configuration.ResolveServicesUsing(FakeIoC.GetAllInstances)); var serviceLocator = new ServiceLocator(); // Act var instances = serviceLocator.ResolveAll(typeof(IWhatDoIHaveBuilder)); // Assert Assert.That(instances.Single(), Is.EqualTo(expectedInstance)); }
public void Should_resolve_single_instance_using_Resolve_with_generic_type() { // Arrange var expectedInstance = new DefaultWhatDoIHaveBuilder(); FakeIoC.Reset(); FakeIoC.GetInstanceProvider = () => new List <object> { expectedInstance }; SecurityConfigurator.Configure(configuration => configuration.ResolveServicesUsing(FakeIoC.GetAllInstances, FakeIoC.GetInstance)); var serviceLocator = new ServiceLocator(); // Act var instance = serviceLocator.Resolve <IWhatDoIHaveBuilder>(); // Assert Assert.That(instance, Is.EqualTo(expectedInstance)); }