Пример #1
0
        //[Fact]
        public async Task FindStudent_ShouldReturnAnonymousObject_WhenUknownIdPassed()
        {
            // Arrange
            var studentId = 0;

            // Act
            _repoMock.Setup(x => x.GetById(studentId)).ReturnsAsync((Student)null);
            dynamic result = await _controller.FindStudent(studentId);

            var valueFromAnnonymous = result.Value.GetType().GetProperty("text").GetValue(result.Value, null);

            //Assert
            Assert.NotNull(result);
            Assert.Equal("Server error!", valueFromAnnonymous);
        }