예제 #1
0
        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);
            });
        }
예제 #2
0
 public async Task DetailTest()
 {
     var fake             = Mock.Of <ITherapiesRepo>();
     var therapiesService = new TherapiesService(fake);
     var id = "2";
     await therapiesService.DetailsTherapies(id);
 }
예제 #3
0
 public async Task RemoveTest()
 {
     var fake             = Mock.Of <ITherapiesRepo>();
     var therapiesService = new TherapiesService(fake);
     var therapy          = new Therapy()
     {
         Therapy_Name = "Module 3"
     };
     await therapiesService.Delete(therapy);
 }
예제 #4
0
        public async Task UpdateTest()
        {
            var fake             = Mock.Of <ITherapiesRepo>();
            var therapiesService = new TherapiesService(fake);

            var therapy = new Therapy()
            {
                Therapy_Name = "Module 2"
            };
            await therapiesService.Update(therapy);
        }
예제 #5
0
        public async Task AddTest()
        {
            var fake             = Mock.Of <ITherapiesRepo>();
            var therapiesService = new TherapiesService(fake);

            var therapy = new Therapy()
            {
                Therapy_Name = "Module 1"
            };
            await therapiesService.AddAndSave(therapy);
        }
예제 #6
0
 public TherapiesController(TherapiesService therapiesService)
 {
     _therapiesService = therapiesService;
 }