public bool IsTheSameAsAny(IBaseConstruct otherbc) { if (otherbc == null) { return(false); } IBaseConstruct thisbc = baseConstructs.NewGen; if (thisbc != null && thisbc.IsTheSame(otherbc)) { return(true); } thisbc = baseConstructs.PrevGen; if (thisbc != null && thisbc.IsTheSame(otherbc)) { return(true); } thisbc = baseConstructs.User; if (thisbc != null && thisbc.IsTheSame(otherbc)) { return(true); } return(false); }
private bool IsTheSame(IBaseConstruct otherbc) { IBaseConstruct thisbc = baseConstructs.GetFirstNonNullObject(); if (thisbc == null || otherbc == null) { return(false); } return(thisbc.IsTheSame(otherbc)); }
public static void SetupBaseConstructs(MockRepository mocks, IBaseConstruct bc1, IBaseConstruct bc2, ICodeRoot coderoot) { using (mocks.Record()) { Expect.Call(bc1.ShortName).Repeat.Any().Return("bc1"); Expect.Call(bc2.ShortName).Repeat.Any().Return("bc2"); Expect.Call(bc1.IsTheSame(bc1)).Repeat.Any().Return(true); Expect.Call(bc2.IsTheSame(bc2)).Repeat.Any().Return(true); Expect.Call(bc2.WalkChildren()).Repeat.AtLeastOnce().Return(new List <IBaseConstruct>().AsReadOnly()); List <IBaseConstruct> bc1Children = new List <IBaseConstruct>(); bc1Children.Add(bc2); Expect.Call(bc1.WalkChildren()).Repeat.AtLeastOnce().Return(bc1Children.AsReadOnly()); List <IBaseConstruct> rootChildren = new List <IBaseConstruct>(); rootChildren.Add(bc1); Expect.On(coderoot).Call(coderoot.WalkChildren()).Repeat.AtLeastOnce().Return(rootChildren.AsReadOnly()); } }
public static void SetupBaseConstructs(MockRepository mocks, IBaseConstruct bc1, IBaseConstruct bc2, ICodeRoot coderoot) { using(mocks.Record()) { Expect.Call(bc1.ShortName).Repeat.Any().Return("bc1"); Expect.Call(bc2.ShortName).Repeat.Any().Return("bc2"); Expect.Call(bc1.IsTheSame(bc1)).Repeat.Any().Return(true); Expect.Call(bc2.IsTheSame(bc2)).Repeat.Any().Return(true); Expect.Call(bc2.WalkChildren()).Repeat.AtLeastOnce().Return(new List<IBaseConstruct>().AsReadOnly()); List<IBaseConstruct> bc1Children = new List<IBaseConstruct>(); bc1Children.Add(bc2); Expect.Call(bc1.WalkChildren()).Repeat.AtLeastOnce().Return(bc1Children.AsReadOnly()); List<IBaseConstruct> rootChildren = new List<IBaseConstruct>(); rootChildren.Add(bc1); Expect.On(coderoot).Call(coderoot.WalkChildren()).Repeat.AtLeastOnce().Return(rootChildren.AsReadOnly()); } }