public async Task WriteThenReadFromProvisionedTable()
        {
            await _provisioner.CreateTable <SimplePerson>();

            var context = _provisioner.GetContext();

            var person = new SimplePerson {
                Age       = 22,
                CatsOwned = 1,
                FirstName = "Daniel",
                LastName  = "Datum"
            };

            await context.SaveAsync(person);

            var fromDb = await context.LoadAsync <SimplePerson>("Datum", "Daniel");

            using (var poly = PAssert.Poly()) {
                poly.IsTrue(() => fromDb.FirstName == person.FirstName);
                poly.IsTrue(() => fromDb.LastName == person.LastName);
                poly.IsTrue(() => fromDb.Age == person.Age);
                poly.IsTrue(() => fromDb.CatsOwned == person.CatsOwned);
            }

            await _provisioner.Cleanup();
        }
Beispiel #2
0
 public void PolyAssertCanPassATest()
 {
     using (var poly = PAssert.Poly())
     {
         poly.Log("PolyAssert.Log messages are only printed if the test fails");
         poly.Try(() => Assert.True(true));
     }
 }
 static void AssertContentEqual(IEnumerable <string> expected, IEnumerable <string> actual)
 {
     using (var poly = PAssert.Poly())
     {
         poly.IsTrue(() => expected.Count() == actual.Count());
         poly.IsTrue(() => !expected.Except(actual).Any());
         poly.IsTrue(() => !actual.Except(expected).Any());
     }
 }
        public async Task CompareMajorChange()
        {
            var command = new CompareCommand
            {
                Assembly    = "Local.dll",
                PackageName = "Minor"
            };

            var report = await _runner.Compare(command);

            _testOutputHelper.WriteLine(report);

            using (var poly = PAssert.Poly())
            {
                poly.IsTrue(() => report != null);
                poly.IsTrue(() => report.Contains("always bump major"));
            }
        }
Beispiel #5
0
        public async Task ComparePatchChange()
        {
            var command = new CompareCommand {
                Assembly    = "Local.dll",
                PackageName = "Patch"
            };

            var report = await Runner.Compare(command);

            _testOutputHelper.WriteLine(report);

            using (var poly = PAssert.Poly()) {
                poly.IsTrue(() => report != null);
                foreach (var change in _patchChanges)
                {
                    poly.IsTrue(() => report.Contains(change));
                }
            }
        }
        public async Task OverrideRemoveTypeToIgnore()
        {
            var command = new CompareCommand
            {
                Assembly    = "Local.dll",
                PackageName = "Major"
            };

            _fixture.Settings.RuleOverrides["TypeRemovedRule"] = RuleOverrideType.Ignore;

            var report = await _runner.Compare(command);

            _testOutputHelper.WriteLine(report);

            using (var poly = PAssert.Poly())
            {
                poly.IsTrue(() => report != null);
                poly.IsTrue(() => !report.Contains("`ClassToRemove` is no longer present or accessible."));
            }
        }
Beispiel #7
0
        public void PolyAssertCanFinishEarly()
        {
            var x = 6;

            try
            {
                using (var poly = PAssert.Poly())
                {
                    poly.Log("Sometimes you do want to end the test early after all");
                    poly.StopIfErrorsHaveOccurred(); //no stop here
                    poly.Log("So just call StopIfErrorsHaveOccurred (behaves the same as disposing the PolyAssert)");
                    poly.Try(() => Assert.Fail("Wah wah"));
                    poly.StopIfErrorsHaveOccurred(); //no stop here
                    poly.Log("This message should not be printed, as StopIfErrorsHaveOccurred will throw an exception this time");
                }
            }
            catch (Exception e)
            {
                Console.Out.WriteLine(e);
                ApprovalTests.Approvals.Verify(e.ToString(), Scrubber);
            }
        }
Beispiel #8
0
        public void PolyAssert()
        {
            var x = 6;

            try
            {
                using (var poly = PAssert.Poly())
                {
                    poly.Log("I will report all the errors i saw when i get disposed");
                    poly.IsTrue(() => x == 5);
                    poly.IsTrue(() => x == 6);
                    poly.IsTrue(() => x == 7);
                    poly.Try(() => Assert.Fail("Wah wah"));
                    poly.Log("PolyAssert.Log messages are only printed if the test fails");
                }
            }
            catch (Exception e)
            {
                Console.Out.WriteLine(e);
                ApprovalTests.Approvals.Verify(e.ToString(), Scrubber);
            }
        }