Пример #1
0
        public void GetEnrollments_CallsCorrectServicesAndReturnsEnrollments()
        {
            // Arrange
            var indexes     = PropertyInfoTestHelpers.GetTestIndexs();
            var rows        = fixture.CreateMany <string>(3).ToList();
            var enrollments = fixture.CreateMany <Enrollment>(3);

            _csvServiceMock.Setup(s => s.ParseRows(It.IsAny <Dictionary <PropertyInfo, int> >(), It.IsAny <List <string> >())).Returns(enrollments);

            _enrollmentServiceMock.Setup(x => x.GetEnrollmentOutput(It.IsAny <IEnumerable <Enrollment> >())).Returns(enrollments);

            // Act
            var result = _sut.GetEnrollments(indexes, rows);

            // Assert
            _csvServiceMock.Verify(s => s.ParseRows(It.Is <Dictionary <PropertyInfo, int> >(x => x == indexes), It.Is <List <string> >(x => x == rows)), Times.Once);
            _enrollmentServiceMock.Verify(s => s.GetEnrollmentOutput(It.IsAny <IEnumerable <Enrollment> >()), Times.Once);

            Assert.AreEqual(3, result.Count());
        }