public async Task GetTherapiesTest() { var therapies = new List <Therapy> { new Therapy() { Therapy_Name = "Module 5/6" }, new Therapy() { Therapy_Name = "Module 6/6" }, }; var fakeRepositoryMock = new Mock <ITherapiesRepo>(); fakeRepositoryMock.Setup(x => x.GetAll()).ReturnsAsync(therapies); var therapiesService = new TherapiesService(fakeRepositoryMock.Object); var resultTherapies = await therapiesService.GetTherapy(); Assert.Collection(resultTherapies, therapy => { Assert.Equal("Module 5/6", therapy.Therapy_Name); }, therapy => { Assert.Equal("Module 6/6", therapy.Therapy_Name); }); }
// GET: Therapies public async Task <IActionResult> Index() { var therapies = await _therapiesService.GetTherapy(); return(View(therapies)); }