public void Sort() { OrderAttributeComparer <IRepository> .Sort(_repositories); Assert.Equal(1, _repositories[0].GetType().GetCustomAttribute <OrderAttribute>() !.Order); Assert.Equal(2, _repositories[1].GetType().GetCustomAttribute <OrderAttribute>() !.Order); Assert.Null(_repositories[2].GetType().GetCustomAttribute <OrderAttribute>()); }
public void Order_Array_Sort_Without_OrderAttribute() { var instances = new object[] { new Boo(), new Foo(), new Session(null) }; var comparer = new OrderAttributeComparer <object>(); Array.Sort(instances, comparer); Assert.IsType <Boo>(instances[0]); Assert.IsType <Foo>(instances[1]); Assert.IsType <Session>(instances[2]); }