Ejemplo n.º 1
0
        public static void SaveRecord(RecordView recordToSave)
        {
            RecordDAL   recordHandler = new RecordDAL();
            Random      _random       = new Random();
            VaccineView recordVaccine = recordToSave.Vaccines.FirstOrDefault();

            if (recordVaccine != null)
            {
                VaccineView vaccine = VaccineManager.GetVaccine(recordVaccine.Name);
                if (vaccine != null)
                {
                    Record record = new Record
                    {
                        isVaccine    = true,
                        recordNumber = "RCRD" + _random.Next(20, 300),
                        notes        = "",
                        petId        = new Guid(recordToSave.PetId),
                        status       = "open",
                        tags         = GetAnualTags(recordToSave.Tags, recordToSave.Vaccines),
                        type         = "vaccine",
                        vaccineId    = new Guid(vaccine.Id),
                        createdDate  = DateTime.Now,
                        createdBy    = Constant.ADMIN_EMAIL,
                    };
                    recordHandler.Post(record);
                }
            }
        }
Ejemplo n.º 2
0
        public void TestForInfo()
        {
            //Tester Vaccinenes Information
            //arrange
            VaccineView TestVacc = new VaccineView(1, "TestVaccine", "Brugt til Test", 5, 12);
            string      expected = "Brugt til Test";
            string      actual   = TestVacc.Vac_Info;

            //act
            //assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        public void TestForToString()
        {
            //Tester ToString Metoden - Hvad der vises i View/liste
            //arrange
            VaccineView TestVacc = new VaccineView(1, "TestVaccine", "Brugt til Test", 5, 12);
            string      expected = $"TestVaccine  -  12";
            string      actual   = TestVacc.ToString();

            //act
            //assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 4
0
        public void TestForName()
        {
            //Tester Navnet - Vil teste forkert.
            //arrange
            VaccineView TestVacc = new VaccineView(1, "TestVaccine", "Brugt til Test", 5, 12);
            string      expected = "VaccineTest";
            string      actual   = TestVacc.Vac_Navn;

            //act
            //assert
            Assert.AreEqual(expected, actual);
        }