namespace IoC.Tests.UsageScenarios { using Shouldly; using Xunit; public class Arrays { [Fact] public void Run() { // $visible=true // $tag=3 BCL types // $priority=01 // $description=Arrays // $header=To resolve all possible instances of any tags of the specific type as an _array_ just use the injection _T[]_ // { using var container = Container .Create() .Bind().To() // Bind to the implementation #1 .Bind().Tag(1).To() // Bind to the implementation #2 .Bind().Tag(2).Tag("abc").To() // Bind to the implementation #3 .Bind().Tag(3).To() .Container; // Resolve all appropriate instances var instances = container.Resolve(); // } // Check the number of resolved instances instances.Length.ShouldBe(3); foreach (var instance in instances) { // Check the instance instance.ShouldBeOfType(); } } } }