public void GetMixinPosition_MatchesMixinInstances() { MixinData mixinData1 = new MixinData(new object[] { simpleMixin, otherMixin }); Assert.AreEqual(0, mixinData1.GetMixinPosition(typeof(IOtherMixin))); Assert.AreEqual(1, mixinData1.GetMixinPosition(typeof(ISimpleMixin))); MixinData mixinData2 = new MixinData(new object[] { otherMixin, simpleMixin }); Assert.AreEqual(0, mixinData2.GetMixinPosition(typeof(IOtherMixin))); Assert.AreEqual(1, mixinData2.GetMixinPosition(typeof(ISimpleMixin))); }
public void GetMixinPosition_MatchesMixinInstances_WithMultipleInterfacesPerMixin() { MixinData mixinData = new MixinData(new object[] { complexMixin, simpleMixin }); Assert.AreEqual(0, mixinData.GetMixinPosition(typeof(IFirst))); Assert.AreEqual(1, mixinData.GetMixinPosition(typeof(ISecond))); Assert.AreEqual(2, mixinData.GetMixinPosition(typeof(ISimpleMixin))); Assert.AreEqual(3, mixinData.GetMixinPosition(typeof(IThird))); List <object> mixins = new List <object>(mixinData.Mixins); Assert.AreSame(complexMixin, mixins[0]); Assert.AreSame(complexMixin, mixins[1]); Assert.AreSame(simpleMixin, mixins[2]); Assert.AreSame(complexMixin, mixins[3]); }
public void GetMixinPosition() { MixinData mixinData = new MixinData(new object[] { simpleMixin }); Assert.AreEqual(0, mixinData.GetMixinPosition(typeof(ISimpleMixin))); }
public void GetMixinPosition_MatchesMixinInstances_WithMultipleInterfacesPerMixin() { MixinData mixinData = new MixinData(new object[] { complexMixin, simpleMixin }); Assert.AreEqual(0, mixinData.GetMixinPosition(typeof(IFirst))); Assert.AreEqual(1, mixinData.GetMixinPosition(typeof(ISecond))); Assert.AreEqual(2, mixinData.GetMixinPosition(typeof(ISimpleMixin))); Assert.AreEqual(3, mixinData.GetMixinPosition(typeof(IThird))); List<object> mixins = new List<object>(mixinData.Mixins); Assert.AreSame(complexMixin, mixins[0]); Assert.AreSame(complexMixin, mixins[1]); Assert.AreSame(simpleMixin, mixins[2]); Assert.AreSame(complexMixin, mixins[3]); }
public void GetMixinPosition_MatchesMixinInstances() { MixinData mixinData1 = new MixinData(new object[] {simpleMixin, otherMixin}); Assert.AreEqual(0, mixinData1.GetMixinPosition(typeof(IOtherMixin))); Assert.AreEqual(1, mixinData1.GetMixinPosition(typeof(ISimpleMixin))); MixinData mixinData2 = new MixinData(new object[] {otherMixin, simpleMixin}); Assert.AreEqual(0, mixinData2.GetMixinPosition(typeof(IOtherMixin))); Assert.AreEqual(1, mixinData2.GetMixinPosition(typeof(ISimpleMixin))); }