public void CrudByPage_Success()
        {
            // Arrange
            var targetPage = Models.CreateFirstTimeHelp();

            FirstTimeHelpRepository.Create(targetPage);
            var noisePage = Models.CreateFirstTimeHelp();

            FirstTimeHelpRepository.Create(noisePage);

            var targetBullet1 = Models.CreateBullet(pageId: targetPage.Id);

            BulletRepository.Create(targetBullet1);
            var targetBullet2 = Models.CreateBullet(pageId: targetPage.Id);

            BulletRepository.Create(targetBullet2);
            var noiseBullet = Models.CreateBullet(pageId: noisePage.Id);

            BulletRepository.Create(noiseBullet);

            // Act
            var existingTargetBullets = BulletRepository.ReadByPageId(targetPage.Id);

            BulletRepository.DeleteByPageId(targetPage.Id);
            var deletedTargetBullets = BulletRepository.ReadByPageId(targetPage.Id);
            var noiseBullets         = BulletRepository.ReadByPageId(noisePage.Id);

            // Assert
            Assert.AreEqual(2, existingTargetBullets.Count(), "Two bullets should exist before they are deleted.");
            Assert.IsNotNull(existingTargetBullets.Where(b => b.Id == targetBullet1.Id).FirstOrDefault(), "The first target bullet should be included in the bullets read.");
            Assert.IsNotNull(existingTargetBullets.Where(b => b.Id == targetBullet2.Id).FirstOrDefault(), "The second target bullet should be included in the bullets read.");
            Assert.AreEqual(0, deletedTargetBullets.Count(), "Zero bullets should exist after they are deleted.");
            Assert.AreEqual(1, noiseBullets.Count(), "One noise bullet should still exist in the database.");
            Assert.IsNotNull(noiseBullets.Where(b => b.Id == noiseBullet.Id).FirstOrDefault(), "The noise bullet should exist in the noise bullets read.");
        }
        public void Crud_Success()
        {
            var page = Models.CreateFirstTimeHelp();

            FirstTimeHelpRepository.Create(page);

            var newBullet = Models.CreateBullet(pageId: page.Id);

            Assert.AreEqual(0, newBullet.Id, "The bullet id should not be set until after data layer Bullet_Create method is called.");

            BulletRepository.Create(newBullet);
            Assert.AreNotEqual(0, newBullet.Id, "The bullet id should have been set by the data layer.");

            var oldText = newBullet.Text;

            newBullet.Text = "New Bullet Text.";
            BulletRepository.Update(newBullet);

            var existingBullet = BulletRepository.ReadByPageId(page.Id).FirstOrDefault();

            Assert.IsNotNull(existingBullet, "The bullet should still exist in the database.");
            Assert.AreNotEqual(oldText, existingBullet.Text, "The bullet's text should have been updated.");
            Assert.AreEqual(newBullet.VerticalOffset, existingBullet.VerticalOffset, "The rest of the bullet instances' properties should be the same.");

            BulletRepository.Delete(existingBullet.Id);

            var deletedBullet = BulletRepository.ReadByPageId(existingBullet.Id).FirstOrDefault();

            Assert.That(deletedBullet, Is.Null, "The bullet should no longer exist in the database.");
        }
        public void Import_ExistingBullet()
        {
            // Arrange
            var help = Models.CreateFirstTimeHelp();

            FirstTimeHelpRepository.Create(help);
            var bullet = Models.CreateBullet(pageId: help.Id);

            BulletRepository.Create(bullet);

            // Modify the bullet informatio nto verify the values in the data store are overwritten.
            bullet.Number         = 10;
            bullet.Text           = "Import unit test bullet text.";
            bullet.VerticalOffset = 1089;


            // Act
            BulletRepository.Import(bullet);
            var results = BulletRepository.ReadByPageId(help.Id);

            // Assert
            Assert.That(results, Is.Not.Null, "The bullet should still exist in the data store.");
            Assert.That(results.Count, Is.EqualTo(1), "There should be exactly one bullet associated with the page.");
            var result = results.First();

            Assert.That(result.Id, Is.EqualTo(bullet.Id), "The id should remain the same.");
            Assert.That(result.Text, Is.EqualTo(bullet.Text), "The bullet text should have been updated in the data store.");
            Assert.That(result.VerticalOffset, Is.EqualTo(bullet.VerticalOffset), "The vertical offset should have been updated in the data store.");
        }
        public void Import_NewBullet()
        {
            // Arrange
            var help = Models.CreateFirstTimeHelp();

            FirstTimeHelpRepository.Create(help);
            var bullet = Models.CreateBullet(pageId: help.Id);

            bullet.Id = 42098;

            // Act
            BulletRepository.Import(bullet);
            var results = BulletRepository.ReadByPageId(help.Id);

            // Assert
            Assert.That(results, Is.Not.Null, "The bullet should have been added to the data store.");
            Assert.That(results.Count, Is.EqualTo(1), "There should be exactly one bullet associated with the page.");
            var result = results.First();

            Assert.That(result.Id, Is.EqualTo(bullet.Id), "The id should have been created using the input id.");
        }