Example #1
0
        public void GetAllMedicinesTest()
        {
            dynamic result = controller.Get();
            dynamic val    = result.Value[0];

            Assert.AreEqual(val.Name, items[0].Name);
        }
Example #2
0
        public void GetMedicineTest()
        {
            var medicine     = _fixture.Build <Medicine>().Create();
            var medicineList = new List <Medicine>();

            medicineList.Add(medicine);
            _medicinesManager.Setup(s => s.GetMedicines()).Returns(medicineList);
            var response = _controller.Get();

            Assert.IsNotNull(response);
        }
Example #3
0
        public void GetAllMed_ShouldReturnAvailMeds()
        {
            repo.Setup(m => m.All(null)).Returns(new List <Medicine>()
            {
                new Medicine()
                {
                    Name = "Saridon", Brand = "Saridon", Price = 10.00, ExpiryDate = DateTime.Now.AddDays(30), Id = Guid.NewGuid(), Notes = "hello", Quantity = 100
                }
            });
            var response = controller.Get(null) as ObjectResult;

            var meds = response.Value as List <Medicine>;

            Assert.Single <Medicine>(meds);
        }