public void TestAddingNewAnimalPrescriptionsRecord()
        {
            // Arrange
            bool result = false;
            IAnimalPrescriptionManager animalPrescriptionManager =
                new AnimalPrescriptionsManager(_animalPrescriptionsAccessor);
            AnimalPrescriptionVM animalPrescription = new AnimalPrescriptionVM()
            {
                AnimalID               = 5,
                AnimalPrescriptionID   = 5,
                AnimalVetAppointmentID = 5,
                PrescriptionName       = "test5",
                Dosage               = 2.0M,
                Interval             = "2 times a day",
                AdministrationMethod = "Oral",
                StartDate            = DateTime.Now,
                EndDate              = DateTime.Now.AddDays(2),
                Description          = "test5",
                AnimalName           = "wefyawaw"
            };

            // Act
            result = animalPrescriptionManager.AddAnimalPrescriptionRecord(animalPrescription);

            // Assert
            Assert.IsTrue(result);
        }
        public void TestDeleteNonExistentAnimalPrescriptionRecord()
        {
            // Arrange
            bool result = false;
            IAnimalPrescriptionManager manager =
                new AnimalPrescriptionsManager(_animalPrescriptionsAccessor);
            AnimalPrescriptionVM animalPrescription = new AnimalPrescriptionVM()
            {
                AnimalID               = 5,
                AnimalPrescriptionID   = 100,
                AnimalVetAppointmentID = 1,
                PrescriptionName       = "testfawefawef",
                Dosage               = 2.0M,
                Interval             = "2 times a dayawfeawef",
                AdministrationMethod = "Oral",
                StartDate            = DateTime.Parse("3/20/2020"),
                EndDate              = DateTime.Parse("4/15/2020"),
                Description          = "test",
                AnimalName           = "fawuief",
                Active               = true
            };

            // Act
            result = manager.DeleteAnimalPrescriptionRecord(animalPrescription);

            // Assert
            Assert.IsFalse(result);
        }
        public void TestSelectingAllAnimalPrescriptionRecords()
        {
            // Arrange
            List <AnimalPrescriptionVM> animalPrescriptions =
                new List <AnimalPrescriptionVM>();
            IAnimalPrescriptionManager animalPrescriptionManager =
                new AnimalPrescriptionsManager(_animalPrescriptionsAccessor);

            // Act
            animalPrescriptions = animalPrescriptionManager.RetrieveAllAnimalPrescriptions();

            // Assert
            Assert.AreEqual(4, animalPrescriptions.Count);
        }
        public void TestRetrievingRecordsByActiveAndDeactiveStatus()
        {
            // Arrange
            IAnimalPrescriptionManager manager =
                new AnimalPrescriptionsManager(_animalPrescriptionsAccessor);
            List <AnimalPrescriptionVM> activeRecords;
            List <AnimalPrescriptionVM> inactiveRecords;

            // Act
            activeRecords   = manager.RetrieveAnimalPrescriptionsByActive();
            inactiveRecords = manager.RetrieveAnimalPrescriptionsByActive(false);

            // Assert
            Assert.AreEqual(3, activeRecords.Count);
            Assert.AreEqual(1, inactiveRecords.Count);
        }
        public void TestSelectPrescriptionRecordsByAnInvalidAnimalName()
        {
            // Arrange
            List <AnimalPrescriptionVM> animalPrescriptions =
                new List <AnimalPrescriptionVM>();
            IAnimalPrescriptionManager animalPrescriptionManager =
                new AnimalPrescriptionsManager(_animalPrescriptionsAccessor);
            string animalName = "hrehahsea";

            // Act
            animalPrescriptions =
                animalPrescriptionManager.RetrievePrescriptionsByAnimalName(animalName);

            // Assert
            Assert.AreEqual(0, animalPrescriptions.Count);
        }
        public void TestUpdateNonExistentAnimalPrescriptionRecord()
        {
            // Arrange
            bool result = false;
            AnimalPrescriptionVM existingRecord = new AnimalPrescriptionVM()
            {
                AnimalID               = 500,
                AnimalPrescriptionID   = 1241,
                AnimalVetAppointmentID = 1214,
                PrescriptionName       = "test",
                Dosage               = 2.0M,
                Interval             = "2 times a day",
                AdministrationMethod = "Oral",
                StartDate            = DateTime.Now,
                EndDate              = DateTime.Now.AddDays(2),
                Description          = "test",
                AnimalName           = "fawuief"
            };
            AnimalPrescriptionVM newRecord = new AnimalPrescriptionVM()
            {
                AnimalID               = 1,
                AnimalPrescriptionID   = 1,
                AnimalVetAppointmentID = 1,
                PrescriptionName       = "wefafawef",
                Dosage               = 4.0M,
                Interval             = "3 times a day",
                AdministrationMethod = "Oral",
                StartDate            = DateTime.Now,
                EndDate              = DateTime.Now.AddDays(2),
                Description          = "test",
                AnimalName           = "fawuief"
            };
            IAnimalPrescriptionManager manager =
                new AnimalPrescriptionsManager(_animalPrescriptionsAccessor);

            // Act
            result = manager.EditAnimalPrescriptionRecord(
                existingRecord, newRecord);

            // Assert
            Assert.IsFalse(result);
        }
        public void TestChangeAnimalPrescriptionActiveStatus()
        {
            // Arrange
            bool deactivateResult = false;
            bool activateResult   = false;
            IAnimalPrescriptionManager manager =
                new AnimalPrescriptionsManager(_animalPrescriptionsAccessor);
            AnimalPrescription activeRecord = new AnimalPrescription()
            {
                AnimalPrescriptionID = 1
            };
            AnimalPrescription inActiveRecord = new AnimalPrescription()
            {
                AnimalPrescriptionID = 2
            };

            // Act
            deactivateResult = manager.DeactivateAnimalPrescriptionRecord(activeRecord);
            activateResult   = manager.ActivateAnimalPrescriptionRecord(inActiveRecord);

            // Assert
            Assert.IsTrue(deactivateResult);
            Assert.IsTrue(activateResult);
        }