Example #1
0
        private static void HandleCore <TSubject, TExpectation>(IMaybe <TSubject> subject, IMaybe <TExpectation> expectation, IEquivalencyValidationContext context, IEquivalencyValidator parent)
        {
            expectation.Match(none, some)();

            void none()
            {
                subject.Match(none: () => { },
                              some: _ => new Action(() => AssertionScope.Current.FailWith("Expected subject to be empty, but it was filled.")))();
            }

            void some(TExpectation e)
            {
                subject.Match(none: () => AssertionScope.Current.FailWith("Expected {context:subject} to be filled, but it was empty."),
                              some: (s) => new Action(() => parent.AssertEqualityUsing(context.CreateForMaybeValue(s, e))))();
            }
        }