private static void RunIsCoolTransform(ImportPerson importPerson, ExportPerson returnPerson)
 {
     returnPerson.IsCool =
         importPerson.FavoriteColor == Color.Purple ||
         importPerson.FavoriteColor == Color.Pink ||
         importPerson.FavoriteColor == Color.Green;
 }
        public virtual ExportPerson Create(ImportPerson importPerson)
        {
            var returnPerson = new ExportPerson();

            RunTransforms(importPerson, returnPerson);
            returnPerson.Address = importPerson.Address;

            return(returnPerson);
        }
 private static void RunAcquisitionDateTransform(ImportPerson importPerson, ExportPerson returnPerson)
 {
     if (returnPerson.IsCool)
     {
         returnPerson.AcquisitionDate = importPerson.ObservationDate.AddYears(2);
     }
     else
     {
         returnPerson.AcquisitionDate = null;
     }
 }
        private static void RunSalutationTransform(ImportPerson importPerson, ExportPerson returnPerson)
        {
            switch (importPerson.Gender)
            {
            case Gender.M:
                returnPerson.Name = MaleSalutation + importPerson.Name;
                break;

            case Gender.F:
                returnPerson.Name = FemaleSalutation + importPerson.Name;
                break;
            }
        }
        public void When_the_export_persons_are_created_then_they_are_created_correctly(
            IEnumerable <ImportPerson> dummyImportPersons,
            ExportPerson dummyExportPerson)
        {
            var stubPersonFactory = new Mock <ExportPersonFactory>();

            //On any Create call with ImportPerson export the same dummyExportPerson
            stubPersonFactory
            .Setup(f => f.Create(It.IsAny <ImportPerson>()))
            .Returns(dummyExportPerson);
            var fixture = new Fixture();

            fixture.Inject(stubPersonFactory.Object);
            var sut = fixture.Create <MappingExportPersonListFactory>();

            var result = sut.Create(dummyImportPersons);

            Assert.That(result.Any());
            //Assert all export persons in result refer to dummyExportPerson instance
            Assert.That(result.All(p => p.Equals(dummyExportPerson)));
        }
 private static void RunTransforms(ImportPerson importPerson, ExportPerson returnPerson)
 {
     RunSalutationTransform(importPerson, returnPerson);
     RunIsCoolTransform(importPerson, returnPerson);
     RunAcquisitionDateTransform(importPerson, returnPerson);
 }
示例#7
0
        private void excelAllFieldsEngToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExportPerson exportPerson = CreateExport();

            exportPerson.ExportEng();
        }