예제 #1
0
            public void ShouldReturnTrueIfUnique()
            {
                var clientId = Guid.NewGuid();

                var dbRecords = new List <EmployeeRecord>
                {
                    new EmployeeRecordFactory().WithClientIdNameAndDob(clientId, "Stubbs", DateTime.Now).Build(),
                    new EmployeeRecordFactory().WithClientIdNameAndDob(clientId, "Bickers", DateTime.Today).Build(),
                    new EmployeeRecordFactory().WithClientIdNameAndDob(clientId, "Jones", DateTime.Today).Build(),
                };

                var importRecords = new List <EmployeeRecord>
                {
                    new EmployeeRecordFactory().WithClientIdNameAndDob(clientId, "Richardson", DateTime.Now).Build(),
                    new EmployeeRecordFactory().WithClientIdNameAndDob(clientId, "Syed", DateTime.Now).Build(),
                    new EmployeeRecordFactory().WithClientIdNameAndDob(clientId, "Jones", DateTime.Today.AddDays(-50)).Build(),
                };

                _employeeImportValidatorProvider.Setup(x => x.GetEmployeesImportMatchCriteriaByClient(clientId)).Returns(dbRecords.OfType <IEmployeeImportMatchCriteria>().ToList());

                var validator = new ImportValidator(_employeeImportValidatorProvider.Object);

                Assert.That(validator.IsEmployeeNameAndDobUniqueForClient(importRecords.OfType <IEmployeeImportMatchCriteria>().ToList()),
                            Is.True);
            }
예제 #2
0
            public void ShouldReturnTrueIfHasDuplicates()
            {
                var clientId      = Guid.NewGuid();
                var importRecords = new List <EmployeeRecord>
                {
                    new EmployeeRecordFactory().WithClientIdNameAndDob(clientId, "Stubbs", DateTime.Now).Build(),
                    new EmployeeRecordFactory().WithClientIdNameAndDob(clientId, "Stubbs", DateTime.Today).Build(),
                    new EmployeeRecordFactory().WithClientIdNameAndDob(clientId, "Bickers", DateTime.Today).Build(),
                };

                Assert.IsTrue(ImportValidator.HasDuplicateLastNameDateOfBirth(importRecords));
            }