// GET: Specialty/Details/5
        public async Task <IActionResult> Details(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var specialty = await _specialtyService.GetSpecialty(id);

            if (specialty == null)
            {
                return(NotFound());
            }

            return(View(specialty));
        }
Ejemplo n.º 2
0
        public async Task DeleteSpecialtyTest()
        {
            var fakeRepository   = Mock.Of <ISpecialtyRepository>();
            var specialtyService = new SpecialtyService(fakeRepository);

            var specialty = new Specialty()
            {
                Id = 1, Name = "test"
            };

            await specialtyService.CreateSpecialty(specialty);

            await specialtyService.DeleteSpecialty(specialty);

            Assert.Null(await specialtyService.GetSpecialty(1));
        }
Ejemplo n.º 3
0
        public async Task GetSpecialtyTest()
        {
            var specialty = new Specialty()
            {
                Id = 1, Name = "test specialty"
            };

            var fakeRepositoryMock = new Mock <ISpecialtyRepository>();

            fakeRepositoryMock.Setup(x => x.GetOne(It.IsAny <long?>())).ReturnsAsync(specialty);

            var specialtyService = new SpecialtyService(fakeRepositoryMock.Object);

            var resultSpecialty = await specialtyService.GetSpecialty(1);

            Assert.Equal("test specialty", resultSpecialty.Name);
        }