public void CategoryWithDifferentIdAreNotEqual() { var c1 = new StageCategory("category", Guid.NewGuid()); var c2 = new StageCategory("category", Guid.NewGuid()); Assert.That(c1, Is.Not.EqualTo(c2)); }
public void CategoryWithDifferentIdAreNotEqual() { var c1 = new StageCategory("category", Guid.NewGuid()); var c2 = new StageCategory("category", Guid.NewGuid()); c1.Should().NotBe(c2); }
public void CategoryWithSameIdAreEqual() { var id = Guid.NewGuid(); var c1 = new StageCategory("category", id); var c2 = new StageCategory("category", id); c1.Should().Be(c2); }
public void CategoryNameIsIrrelevant() { var id = Guid.NewGuid(); var c1 = new StageCategory("c1", id); var c2 = new StageCategory("c2", id); c1.Should().Be(c2); }
public void CategoryWithSameIdAreEqual() { var id = Guid.NewGuid(); var c1 = new StageCategory("category", id); var c2 = new StageCategory("category", id); Assert.That(c1, Is.EqualTo(c2)); }
public void CategoryNameIsIrrelevant() { var id = Guid.NewGuid(); var c1 = new StageCategory("c1", id); var c2 = new StageCategory("c2", id); Assert.That(c1, Is.EqualTo(c2)); }
internal static void EnsureIsCompatibleWith <T>(this T component, StageCategory containingStageCategory) where T : IBaseComponent, IPersistPropertyBag { var componentCategories = component.GetStageCategories(); if (!containingStageCategory.IsCompatibleWith(componentCategories)) { throw new ArgumentException( string.Format( "{0} is made for any of the {1} stages and is not compatible with a {2} stage.", component.Name, componentCategories.Aggregate(string.Empty, (names, sc) => names + ", " + sc.Name, names => names.Substring(2)), containingStageCategory.Name), "component"); } }
internal static StageCategory[] GetStageCategories <T>(this T component) where T : IBaseComponent, IPersistPropertyBag { component.EnsureIsPipelineComponent(); var stageCategories = component.GetType().GetCustomAttributes(typeof(ComponentCategoryAttribute), false) .Cast <ComponentCategoryAttribute>() .Where(a => StageCategory.IsKnownCategoryId(a.Category)) .Select(a => StageCategory.FromKnownCategoryId(a.Category)) .ToArray(); if (!stageCategories.Any()) { throw new ArgumentException( string.Format( "{0} has not been associated with a pipeline stage category. Apply the ComponentCategoryAttribute with one of the stage categories available through {1}.", component.GetType().Name, typeof(CategoryTypes).FullName)); } return(stageCategories); }
internal Stage(Guid categoryId, PipelinePolicy pipelinePolicy) { Category = StageCategory.FromKnownCategoryId(categoryId); StagePolicy = pipelinePolicy.Stages.Cast <StagePolicy>().Single(s => new Guid(s.StageIdGuid) == Category.Id); Components = new ComponentList(this); }
internal Stage(Guid categoryId) { Category = StageCategory.FromKnownCategoryId(categoryId); Components = new ComponentList(this); }