示例#1
0
        public void SingleProperty_AssertPass()
        {
            var reportHeader = new ReportHeader();

            reportHeader.ShouldNotifyFor(x => x.Report)
            .When(() => reportHeader.Report = "Setup Sheet");
        }
示例#2
0
        public void NonPropertyExpression_Exception()
        {
            var reportHeader = new ReportHeader();

            var ex = Assert.Throws <ArgumentException>(() =>
                                                       reportHeader.ShouldNotifyFor(x => "not a property expression"));

            Assert.That(
                ex.Message,
                Is.EqualTo("Expression must be a simple property access of the form \"x => x.PropertyName\"."));
        }
示例#3
0
        public void MultipleProperties_SingleNotification_AssertFail()
        {
            var reportHeader = new ReportHeader();

            var ex = Assert.Throws <AssertionException>(() =>
                                                        reportHeader.ShouldNotifyFor(x => x.Customer)
                                                        .And(x => x.Xml)
                                                        .When(() => reportHeader.Customer = "Mick"));

            const string ExpectedMessage = "Expected PropertyChanged to fire for Xml Expectation met for Customer";

            Assert.That(
                ex.Message,
                Is.EqualTo(ExpectedMessage));
        }
示例#4
0
        public void SingleProperty_AssertFail()
        {
            var reportHeader = new ReportHeader();

            var ex = Assert.Throws <AssertionException>(() =>
                                                        reportHeader.ShouldNotifyFor(x => x.Report)
                                                        .When(
                                                            () =>
            {
                /* Do nothing so we expect an assert */
            }));

            Assert.That(
                ex.Message,
                Is.EqualTo("Expected PropertyChanged to fire for Report"));
        }