public void Matches_GivenDiscoverCommand_EngineCalledOnceWithParametersComingFromDiscoveryCommand() { var disco = new DiscoveryRequestFactory().Build( "ConnectionString", "member-caption", "perspective", "dimension", "hierarchy", null); var memberStub = new Mock <NBi.Core.Analysis.Member.Member>(); var member1 = memberStub.Object; var member2 = memberStub.Object; var members = new MemberResult(); members.Add(member1); members.Add(member2); var meMock = new Mock <MembersAdomdEngine>(); meMock.Setup(engine => engine.GetMembers(disco)) .Returns(members); var me = meMock.Object; var orderedConstraint = new OrderedConstraint() { MembersEngine = me }; //Method under test orderedConstraint.Matches(disco); //Test conclusion meMock.Verify(engine => engine.GetMembers(disco), Times.Once()); }
public void Matches_AlphabeticallyNotCorrectlyOrdered_Failed() { var members = new MemberResult(); members.Add("A member"); members.Add("C member"); members.Add("B member"); var orderedConstraint = new OrderedConstraint(); orderedConstraint = orderedConstraint.Alphabetical; //Method under test var res = orderedConstraint.Matches(members); //Test conclusion Assert.That(res, Is.False); }
public void Matches_NumericalNotCorrectlyOrdered_Failed() { var members = new MemberResult(); members.Add("1"); members.Add("100"); members.Add("5"); var orderedConstraint = new OrderedConstraint(); orderedConstraint = orderedConstraint.Numerical; //Method under test var res = orderedConstraint.Matches(members); //Test conclusion Assert.That(res, Is.False); }
public void Matches_ReverseCorrectlyOrdered_Validated() { var members = new MemberResult(); members.Add("C member"); members.Add("B member"); members.Add("A member"); var orderedConstraint = new OrderedConstraint(); orderedConstraint = orderedConstraint.Descending; //Method under test var res = orderedConstraint.Matches(members); //Test conclusion Assert.That(res, Is.True); }
public void Matches_ChronologicalNotCorrectlyOrdered_Failed() { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr-be"); var members = new MemberResult(); members.Add("20/10/2010"); members.Add("3/10/2011"); members.Add("5/2/2011"); var orderedConstraint = new OrderedConstraint(); orderedConstraint = orderedConstraint.Chronological; //Method under test var res = orderedConstraint.Matches(members); //Test conclusion Assert.That(res, Is.False); }
public void Matches_SpecificNotCorrectlyOrdered_Failed() { var members = new MemberResult(); members.Add("Leopold"); members.Add("Baudoin"); members.Add("Albert"); var ordspec = new List <object>(); ordspec.Add("Leopold"); ordspec.Add("Albert"); ordspec.Add("Baudoin"); var orderedConstraint = new OrderedConstraint(); orderedConstraint = orderedConstraint.Specific(ordspec); //Method under test var res = orderedConstraint.Matches(members); //Test conclusion Assert.That(res, Is.False); }