Ejemplo n.º 1
0
        public async Task GetProfessorById_ShouldReturnInstanceOfProfessor()
        {
            // Arrange
            _mockReadRepository.Setup(repo => repo.GetByIdAsync <Professor>(_professor1.Id)).ReturnsAsync(_professor1);
            // Act
            Professor actualProfessor = await _professorService.GetProfessorById(_professor1.Id);

            // Assert
            actualProfessor.Should().BeEquivalentTo(_professor1);
        }
        public void GivenAProfessorService_WhenCallingGetProfessorWithNonExistingID_ThenRecieveNull()
        {
            //Given
            var professorService = new ProfessorService();
            //When
            var actual = professorService.GetProfessorById(5);

            //Then
            Assert.Null(actual);
        }
        public void GivenAProfessorService_WhenCallingGetProfessor_ThenRecieveProfessor()
        {
            //Given
            var professorService = new ProfessorService();
            //When
            var actual = professorService.GetProfessorById(1);

            //Then
            Assert.Equal("Gobelijn", actual.LastName);
        }
        public void GivenAProfessorService_WhenCallingUpdateProfessor_TheRecieveTheUpdatedProfessor()
        {
            //Given
            var professorService = new ProfessorService();
            //When
            var update = professorService.UpdateProfessor(1, "bart", "simpson");
            var actual = professorService.GetProfessorById(1);

            //Then
            Assert.Equal("simpson", actual.LastName);
        }