public void can_use_predicates_to_filter_deep_enumerations_failure_case_single()
        {
            var message = new FakeMessage();

            var IsBundle = Should.Be(o => ((Release)o).ReleaseTypes.Single().Value == "Bundle", "Bundle");

            var result = Check.That(message).Releases("single", IsBundle).ReleaseIds.ICPN.Value[Should.BeEmpty];

            Assert.That(result.Success, Is.False);
            Assert.That(result.Reasons, Contains.Item("FakeMessage.Releases(Matching: Bundle).ReleaseIds.ICPN.Value should be empty but is \"bundle icpn\""));
        }
        public void can_use_predicates_to_filter_deep_enumerations_failure_case_all()
        {
            var message = new FakeMessage();

            var IsTrack = Should.Be(o => ((Release)o).ReleaseTypes.Single().Value == "TrackRelease", "Track release");

            var result = Check.That(message).Releases("all", IsTrack).ReleaseIds.ISRC.Value[Should.BeEmpty];

            Assert.That(result.Success, Is.False);
            Assert.That(result.Reasons, Contains.Item("FakeMessage.Releases(Matching: Track release)[0].ReleaseIds.ISRC.Value should be empty but is \"first track isrc\""));
            Assert.That(result.Reasons, Contains.Item("FakeMessage.Releases(Matching: Track release)[1].ReleaseIds.ISRC.Value should be empty but is \"second track isrc\""));
        }
        public void can_use_predicates_to_filter_deep_enumerations()
        {
            var message = new FakeMessage();

            var IsBundle = Should.Be(o => ((Release)o).ReleaseTypes.Single().Value == "Bundle", "Bundle");
            var IsTrack  = Should.Be(o => ((Release)o).ReleaseTypes.Single().Value == "TrackRelease", "Track release");

            // This checks that we have exactly 1 bundle release that has a non-empty ICPN
            // and that all track releases have non-empty ISRCs
            // (note that 'ReleaseIds' has an implicit "single" specification)
            var result1 = Check.That(message).Releases("single", IsBundle).ReleaseIds.ICPN.Value[Should.NotBeEmpty];
            var result2 = Check.That(message).Releases("all", IsTrack).ReleaseIds.ISRC.Value[Should.NotBeEmpty];

            Assert.That(result1.Success, Is.True, "Bundle ICPN: " + result1.Reason);
            Assert.That(result2.Success, Is.True, "Track ISRC: " + result2.Reason);
        }
        public void can_use_predicates_to_filter_deep_enumerations()
        {
            var message = new FakeMessage();

            var IsBundle = Should.Be(o => ((Release) o).ReleaseTypes.Single().Value == "Bundle", "Bundle");
            var IsTrack = Should.Be(o => ((Release) o).ReleaseTypes.Single().Value == "TrackRelease", "Track release");

            // This checks that we have exactly 1 bundle release that has a non-empty ICPN
            // and that all track releases have non-empty ISRCs
            // (note that 'ReleaseIds' has an implicit "single" specification)
            var result1 = Check.That(message).Releases("single", IsBundle).ReleaseIds.ICPN.Value[Should.NotBeEmpty];
            var result2 = Check.That(message).Releases("all", IsTrack).ReleaseIds.ISRC.Value[Should.NotBeEmpty];

            Assert.That(result1.Success, Is.True, "Bundle ICPN: " + result1.Reason);
            Assert.That(result2.Success, Is.True, "Track ISRC: " + result2.Reason);
        }
        public void can_use_predicates_to_filter_deep_enumerations_failure_case_all()
        {
            var message = new FakeMessage();

            var IsTrack = Should.Be(o => ((Release) o).ReleaseTypes.Single().Value == "TrackRelease", "Track release");

            var result = Check.That(message).Releases("all", IsTrack).ReleaseIds.ISRC.Value[Should.BeEmpty];

            Assert.That(result.Success, Is.False);
            Assert.That(result.Reasons, Contains.Item("FakeMessage.Releases(Matching: Track release)[0].ReleaseIds.ISRC.Value should be empty but is \"first track isrc\""));
            Assert.That(result.Reasons, Contains.Item("FakeMessage.Releases(Matching: Track release)[1].ReleaseIds.ISRC.Value should be empty but is \"second track isrc\""));
        }
        public void can_use_predicates_to_filter_deep_enumerations_failure_case_single()
        {
            var message = new FakeMessage();

            var IsBundle = Should.Be(o => ((Release) o).ReleaseTypes.Single().Value == "Bundle", "Bundle");

            var result = Check.That(message).Releases("single", IsBundle).ReleaseIds.ICPN.Value[Should.BeEmpty];

            Assert.That(result.Success, Is.False);
            Assert.That(result.Reasons, Contains.Item("FakeMessage.Releases(Matching: Bundle).ReleaseIds.ICPN.Value should be empty but is \"bundle icpn\""));
        }