Exemplo n.º 1
0
        public async void InsertAndGetMultipleEventPages()
        {
            var length = 10;

            for (var i = 0; i < length; i++)
            {
                Mocks.Identifier += i;
                var expected = Mocks.EventPage;
                await _persistenceService.Insert(expected);

                var actual = await _persistenceService.Get <EventPage> (expected.PrimaryKey);

                AssertionHelper.AssertEventPage(expected, actual);
            }

            // check whether or not the "desired" entry exists
            var count = await _persistenceService.Connection.Table <EventPage> ().CountAsync();

            Assert.AreEqual(length, count);

            await _persistenceService.Connection.DeleteAllAsync <EventPage> ();

            count = await _persistenceService.Connection.Table <EventPage> ().CountAsync();

            Assert.AreEqual(0, count);
        }
Exemplo n.º 2
0
        public async void InsertAndGetEventPage()
        {
            var expected = Mocks.EventPage;

            Assert.AreEqual(0, expected.PrimaryKey);
            var page = await _persistenceService.Get <EventPage> (expected.PrimaryKey);

            Assert.Null(page, "page is not null");

            await _persistenceService.Insert(expected);

            Assert.AreNotEqual(0, expected.PrimaryKey);
            page = await _persistenceService.Get <EventPage> (expected.PrimaryKey);

            AssertionHelper.AssertEventPage(expected, page);

            await _persistenceService.Delete(page);

            page = await _persistenceService.Get <EventPage> (expected.PrimaryKey);

            Assert.Null(page, "page is not null");
        }