public void WriteTo_FailingAssertionForExactly_TextContainsFewKeyInfo() { var cmd = new DiscoveryRequestFactory().Build( "connectionString", "member-caption", "perspective-name", "dimension-caption", "hierarchy-caption", 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 meStub = new Mock <MembersAdomdEngine>(); meStub.Setup(engine => engine.GetMembers(cmd)) .Returns(members); var me = meStub.Object; var countConstraint = new CountConstraint() { MembersEngine = me }; countConstraint.Exactly(10); //Method under test string assertionText = null; try { Assert.That(cmd, countConstraint); } catch (AssertionException ex) { assertionText = ex.Message; } //Test conclusion Assert.That(assertionText, Is.StringContaining("perspective-name").And .StringContaining("dimension-caption").And .StringContaining("hierarchy-caption").And .StringContaining("member-caption").And .StringContaining("children").And .StringContaining("exactly").And .StringContaining("10")); }
public void Matches_ExactlyWronglySpecified_Validated() { var members = new MemberResult(); members.Add("First member"); members.Add("Second member"); var countConstraint = new CountConstraint(); countConstraint.Exactly(1); //Method under test var res = countConstraint.Matches(members); //Test conclusion Assert.That(res, Is.False); }