public void should_correctly_order_priorities() { var defaultPrioritySystem = new DefaultPriorityGroupSystem(); var higherThanDefaultPrioritySystem = new HigherThanDefaultPriorityGroupSystem(); var lowerThanDefaultPrioritySystem = new LowerThanDefaultPriorityGroupSystem(); var lowPrioritySystem = new LowestPriorityGroupSystem(); var highPrioritySystem = new HighestPriorityGroupSystem(); var systemList = new List <IGroupSystem> { defaultPrioritySystem, higherThanDefaultPrioritySystem, lowerThanDefaultPrioritySystem, lowPrioritySystem, highPrioritySystem }; var orderedList = systemList.OrderByPriority().ToList(); Assert.Equal(5, orderedList.Count); Assert.Equal(highPrioritySystem, orderedList[0]); Assert.Equal(higherThanDefaultPrioritySystem, orderedList[1]); Assert.Equal(defaultPrioritySystem, orderedList[2]); Assert.Equal(lowerThanDefaultPrioritySystem, orderedList[3]); Assert.Equal(lowPrioritySystem, orderedList[4]); }
public void should_correctly_order_view_systems() { var defaultPrioritySystem = new DefaultPriorityGroupSystem(); var defaultPrioritySetupSystem = new DefaultPrioritySetupSystem(); var higherThanDefaultPrioritySystem = new HigherThanDefaultPriorityGroupSystem(); var lowerThanDefaultPrioritySystem = new LowerThanDefaultPriorityGroupSystem(); var lowPrioritySystem = new LowestPriorityGroupSystem(); var lowPrioritySetupSystem = new LowestPrioritySetupSystem(); var highPrioritySystem = new HighestPriorityGroupSystem(); var highPrioritySetupSystem = new HighestPrioritySetupSystem(); var defaultPriorityViewSystem = new DefaultPriorityViewResolverSystem(); var highestPriorityViewSystem = new HighestPriorityViewResolverSystem(); var lowestPriorityViewSystem = new LowestPriorityViewResolverSystem(); var systemList = new List <ISystem> { defaultPrioritySystem, higherThanDefaultPrioritySystem, lowerThanDefaultPrioritySystem, lowPrioritySystem, highPrioritySystem, defaultPrioritySetupSystem, lowPrioritySetupSystem, highPrioritySetupSystem, defaultPriorityViewSystem, highestPriorityViewSystem, lowestPriorityViewSystem }; var mockContainer = Substitute.For <IDependencyContainer>(); var mockApplication = Substitute.For <IEcsRxApplication>(); mockContainer.ResolveAll(typeof(ISystem)).Returns(systemList); mockApplication.Container.Returns(mockContainer); var orderedSystems = ViewApplicationExtensions.GetAllBoundViewSystems(mockApplication).ToList(); Assert.Equal(11, orderedSystems.Count); Assert.Equal(highPrioritySetupSystem, orderedSystems[0]); Assert.Equal(defaultPrioritySetupSystem, orderedSystems[1]); Assert.Equal(lowPrioritySetupSystem, orderedSystems[2]); Assert.Equal(highestPriorityViewSystem, orderedSystems[3]); Assert.Equal(defaultPriorityViewSystem, orderedSystems[4]); Assert.Equal(lowestPriorityViewSystem, orderedSystems[5]); Assert.Equal(highPrioritySystem, orderedSystems[6]); Assert.Equal(higherThanDefaultPrioritySystem, orderedSystems[7]); Assert.Equal(defaultPrioritySystem, orderedSystems[8]); Assert.Equal(lowerThanDefaultPrioritySystem, orderedSystems[9]); Assert.Equal(lowPrioritySystem, orderedSystems[10]); }