public void PopulateFeature_SkipProviders_ForOtherFeatures() { // Arrange var manager = new PartManager(); manager.Parts.Add(new OtherPart("OtherPart")); manager.PartFeatureProviders.Add( new TestPartFeatureProvider((f, n) => f.Values.Add($"TestPartFeatureProvider{n}"))); var feature = new TestFeature(); // Act manager.PopulateFeature(feature); // Assert Assert.Empty(feature.Values.ToArray()); }
public void PopulateFeature_InvokesOnlyProviders_ForAGivenFeature() { // Arrange var manager = new PartManager(); manager.Parts.Add(new TestPart("TestPart")); manager.PartFeatureProviders.Add( new TestPartFeatureProvider((f, n) => f.Values.Add($"TestPartFeatureProvider{n}"))); manager.PartFeatureProviders.Add( new OtherPartFeatureProvider((f, n) => f.Values.Add($"OtherPartFeatureProvider{n}"))); var feature = new TestFeature(); var expectedResults = new[] { "TestPartFeatureProviderTestPart" }; // Act manager.PopulateFeature(feature); // Assert Assert.Equal(expectedResults, feature.Values.ToArray()); }