Exemplo n.º 1
0
        public void Run_Given__ClassWithPropertyConcurrencyIssues_And_MultipleIgnoreMemberPath_Should_ReturnReportWithNoIssues()
        {
            var instance = new ClassWithPropertiesConcurrencyIssue();
            var finder   = new ConcurrencyChecker(instance, "ClassWithPropertiesConcurrencyIssue->AddressLine1", "ClassWithPropertiesConcurrencyIssue->AddressLine2");

            var report = finder.Run(4, () => instance.ChangeAddress("Ring Road", "Johannesburg"),
                                    () => instance.ChangeAddress("Justice Street", "Polokwane"));

            Console.WriteLine(report);

            Assert.IsNull(report);
        }
Exemplo n.º 2
0
        public void Run_Given_ClassWithPropertyConcurrencyIssues_And_IgnoreMemberPath_Should_ReturnReportWithNoIssues()
        {
            var instance = new ClassWithPropertiesConcurrencyIssue();
            var finder   = new ConcurrencyChecker(instance, "ClassWithPropertiesConcurrencyIssue->AddressLine1");

            var report = finder.Run(4, () => instance.ChangeAddress("Ring Road", "Johannesburg"),
                                    () => instance.ChangeAddress("Justice Street", "Polokwane"));

            Console.WriteLine(report);

            Assert.IsNotNull(report);
            Assert.IsFalse(report.Contains(
                               "ClassWithPropertiesConcurrencyIssue->AddressLine1: Reference and actual number of value changes does not match."));
            Assert.IsFalse(report.Contains(
                               "ClassWithPropertiesConcurrencyIssue->AddressLine1: Reference Value Changes: \n0: String = 111 Church Street\n1: String = Ring Road"));
            Assert.IsFalse(report.Contains(
                               "ClassWithPropertiesConcurrencyIssue->AddressLine1: Actual Value Changes: \n0: String = 111 Church Street\n1: String = Ring Road\n2: String = Justice Street"));
            Assert.IsTrue(report.Contains(
                              "ClassWithPropertiesConcurrencyIssue->AddressLine2: Reference and actual number of value changes does not match."));
            Assert.IsTrue(report.Contains(
                              "ClassWithPropertiesConcurrencyIssue->AddressLine2: Reference Value Changes: \n0: String = Pretoria\n1: String = Johannesburg"));
            Assert.IsTrue(report.Contains(
                              "ClassWithPropertiesConcurrencyIssue->AddressLine2: Actual Value Changes: \n0: String = Pretoria\n1: String = Johannesburg\n2: String = Polokwane"));
        }