private static void RunIsCoolTransform(ImportPerson importPerson, ExportPerson returnPerson)
 {
     returnPerson.IsCool =
         importPerson.FavoriteColor == Color.Purple ||
         importPerson.FavoriteColor == Color.Pink ||
         importPerson.FavoriteColor == Color.Green;
 }
        public void When_the_exported_person_iscool_property_is_false_then_the_acquisitiondate_is_null(
            ExportPersonFactory sut)
        {
            ImportPerson importPerson = SetupUncoolPerson();

            var result = sut.Create(importPerson);

            Assert.IsNull(result.AcquisitionDate);
        }
        public void When_the_imported_person_favorite_color_is_purple_pink_or_green_then_the_exported_person_iscool_is_true(
            ExportPersonFactory sut)
        {
            ImportPerson importPerson = SetupCoolPerson();

            var result = sut.Create(importPerson);

            Assert.IsTrue(result.IsCool);
        }
        public void When_the_imported_person_favorite_color_is_blue_red_or_orange_then_the_exported_person_iscool_is_false(
            ExportPersonFactory sut)
        {
            ImportPerson importPerson = SetupUncoolPerson();

            var result = sut.Create(importPerson);

            Assert.IsFalse(result.IsCool);
        }
        public virtual ExportPerson Create(ImportPerson importPerson)
        {
            var returnPerson = new ExportPerson();

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

            return(returnPerson);
        }
        private static ImportPerson SetupUncoolPerson()
        {
            var unCoolColors    = new[] { Color.Blue, Color.Orange, Color.Red };
            var randomCoolColor = unCoolColors[new Random().Next(3)];
            var importPerson    = new ImportPerson {
                FavoriteColor = randomCoolColor
            };

            return(importPerson);
        }
        private static ImportPerson SetupCoolPerson()
        {
            var coolColors      = new[] { Color.Purple, Color.Pink, Color.Green };
            var randomCoolColor = coolColors[new Random().Next(3)];
            var importPerson    = new ImportPerson {
                FavoriteColor = randomCoolColor
            };

            return(importPerson);
        }
        public void When_the_imported_person_has_a_gender_of_F_then_the_exported_person_name_is_prepended_with_Mrs(
            ExportPersonFactory sut)
        {
            var importPerson = new ImportPerson {
                Gender = Gender.F, Name = "Briana"
            };

            var result = sut.Create(importPerson);

            Assert.AreEqual("Ms. Briana", result.Name);
        }
 private static void RunAcquisitionDateTransform(ImportPerson importPerson, ExportPerson returnPerson)
 {
     if (returnPerson.IsCool)
     {
         returnPerson.AcquisitionDate = importPerson.ObservationDate.AddYears(2);
     }
     else
     {
         returnPerson.AcquisitionDate = null;
     }
 }
        public void When_the_exported_person_is_created_then_the_address_is_copied(
            string dummyAddress,
            ExportPersonFactory sut)
        {
            var importPerson = new ImportPerson {
                Address = dummyAddress
            };

            var result = sut.Create(importPerson);

            Assert.AreEqual(dummyAddress, result.Address);
        }
        public void When_the_exported_person_iscool_property_is_true_then_the_acquisitiondate_is_2_years_after_imported_person_observation_date(
            ExportPersonFactory sut)
        {
            ImportPerson importPerson = SetupCoolPerson();

            importPerson.ObservationDate = DateTime.Now;

            var result = sut.Create(importPerson);

            Assert.IsTrue(result.AcquisitionDate != null);
            Assert.AreEqual(importPerson.ObservationDate.AddYears(2), result.AcquisitionDate);
        }
        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;
            }
        }
 private static void RunTransforms(ImportPerson importPerson, ExportPerson returnPerson)
 {
     RunSalutationTransform(importPerson, returnPerson);
     RunIsCoolTransform(importPerson, returnPerson);
     RunAcquisitionDateTransform(importPerson, returnPerson);
 }