Esempio n. 1
0
        public void AllowAddingNewVerifiables()
        {
            var verifiable1 = new MockVerifiable();

            verifiable1.Verify.Return(new[] { new VerificationResult("My Verification", false) });

            var verifiable2 = new MockVerifiable();

            verifiable2.Verify.Return(new[] { new VerificationResult("My other verification", true) });

            IVerifiable group = new VerificationGroup("My Group")
            {
                verifiable1,
                verifiable2
            };

            var groupResult = group.Verify();
            var result      = Assert.Single(groupResult);

            var expectedResult = new VerificationResult("Verification Group 'My Group':", new[]
            {
                new VerificationResult("My Verification", false),
                new VerificationResult("My other verification", true)
            });

            result.AssertEquals(expectedResult);
        }
Esempio n. 2
0
        public void AcceptName()
        {
            IVerifiable group       = new VerificationGroup("Group Name");
            var         groupResult = group.Verify();
            var         result      = Assert.Single(groupResult);

            Assert.True(result.Success);
            Assert.Equal("Verification Group 'Group Name':", result.Description);
        }
Esempio n. 3
0
        public void ReturnSingleSuccessfulResultIfEmpty()
        {
            IVerifiable group       = new VerificationGroup();
            var         groupResult = group.Verify();
            var         result      = Assert.Single(groupResult);

            Assert.True(result.Success);
            Assert.Equal("Verification Group:", result.Description);
        }
Esempio n. 4
0
        public void PassFormatProviderToGroupMembers()
        {
            var verifiable = new MockVerifiable();

            verifiable.Verify
            .RecordBeforeCall(out var ledger)
            .Return(new[] { new VerificationResult("aha", true) });

            IVerifiable group = new VerificationGroup("My Group")
            {
                verifiable
            };

            var french   = new CultureInfo("fr-FR");
            var japanese = new CultureInfo("ja-JP");

            group.Verify(french);
            group.Verify(japanese);

            Assert.Equal(new IFormatProvider[] { french, japanese }, ledger);
            Assert.Equal(new IFormatProvider[] { french, japanese }, ledger.ToArray());
        }