Beispiel #1
0
        public void GetAll_ValidRequest_Success()
        {
            // arrange
            var clinic = new Clinic()
            {
                Id         = 1,
                Name       = "Test Clinic",
                IsActive   = true,
                Equipments = new List <Equipment>()
                {
                    new Equipment()
                    {
                        Id       = 1,
                        Name     = "Test Equipment",
                        IsActive = true,
                        ClinicId = 1
                    }
                }
            };
            var clinicList = (IEnumerable <Clinic>) new List <Clinic> {
                clinic
            };
            var response = new Response <IEnumerable <Clinic> >
            {
                IsSucceed    = true,
                Result       = clinicList,
                ErrorMessage = null
            };

            _unitOfWork.Setup(x => x.ClinicRepository.GetAll()).Returns(clinicList);

            // act
            var result = _clinicService.GetAll();

            // assert
            Assert.AreEqual(response.Result.Count(), result.Result.Count());
        }