Exemple #1
0
        public void GetMatchingHeader_ReturnsNull_WhenNotFound()
        {
            // Arrange
            var headers = new List <string>
            {
                "id", "first_name", "last_name", "version", "insurance_company"
            };

            var property = PropertyInfoTestHelpers.GetTestProperties().First(prop => prop.Name == "UserId");

            // Act
            var result = _sut.GetMatchingHeader(headers, property);

            // Assert
            Assert.IsNull(result);
        }
Exemple #2
0
        public void GetMatchingHeader_ReturnsExpectedHeader_WhenFound()
        {
            // Arrange
            var userId = "user_id";

            var headers = new List <string>
            {
                userId, "first_name", "last_name", "version", "insurance_company"
            };

            var property = PropertyInfoTestHelpers.GetTestProperties().First(prop => prop.Name == "UserId");

            // Act
            var result = _sut.GetMatchingHeader(headers, property);

            // Assert
            Assert.AreEqual(userId, result);
        }
        public void GetHeaderRow_ReturnsHeaderRow_WhenIsHeaderRow()
        {
            // Arrange
            var enrollmentRows = fixture.CreateMany <string>(3).ToList();
            var headers        = fixture.CreateMany <string>(3).ToList();
            var properties     = PropertyInfoTestHelpers.GetTestProperties();

            _csvServiceMock.Setup(s => s.GetAssumedHeaderRow(It.IsAny <List <string> >())).Returns(headers);
            _csvServiceMock.Setup(s => s.IsHeaderRow(It.IsAny <List <string> >())).Returns(true);
            _enrollmentServiceMock.Setup(s => s.GetEnrollmentProperties()).Returns(properties);

            // Act
            var result = _sut.GetHeaderRow(enrollmentRows);

            // Assert
            _csvServiceMock.Verify(s => s.GetAssumedHeaderRow(It.Is <List <string> >(x => x == enrollmentRows)), Times.Once);
            _csvServiceMock.Verify(s => s.IsHeaderRow(It.Is <List <string> >(x => x == headers)), Times.Once);
            _enrollmentServiceMock.Verify(s => s.GetEnrollmentProperties(), Times.Once);

            _userFeedbackServiceMock.Verify(s => s.HeaderCountNotSameAsPropertyCount(It.Is <int>(x => x == 3), It.Is <int>(x => x == 5)));
            Assert.AreEqual(headers, result);
        }