Пример #1
0
        public async Task GetAsync_StudentIdExists_ReturnsStudentInfo()
        {
            Mock <IStudentRepository> studentRepositoryMock = new Mock <IStudentRepository>();

            studentRepositoryMock.Setup(m => m.GetAsync(It.IsAny <int>())).ReturnsAsync(this.GetStudent(It.IsAny <int>()));
            DataAccess.Model.Student expected = this.GetStudent(It.IsAny <int>());

            DataAccess.Model.Student actual = await studentRepositoryMock.Object.GetAsync(It.IsAny <int>());

            actual.Should().NotBeNull();
            actual.Should().BeEquivalentTo(expected);
        }
Пример #2
0
        public async Task GetAsync_StudentIdDoesnotExist_ReturnsNullObject()
        {
            Mock <IStudentRepository> studentRepositoryMock = new Mock <IStudentRepository>();

            studentRepositoryMock.Setup(m => m.GetAsync(It.IsAny <int>())).ReturnsAsync(this.GetStudent_DoesnotExit(It.IsAny <int>()));

            DataAccess.Model.Student actual = await studentRepositoryMock.Object.GetAsync(It.IsAny <int>());

            actual.Should().BeNull();
        }