public void WriteToJson()
 {
     var family = new Family();
     var me = family.Add("me");
     family.Add("mom").Is.TheParentOf(me);
     family.Add("dad").Is.TheParentOf(me);
     DebugWrite(family);
 }
 private static void DebugWrite(Family family)
 {
     using (var stream = new MemoryStream())
     {
         var writer = new StreamWriter(stream);
         new FamilyWriter(family, writer).Write();
         writer.Flush();
         stream.Position = 0;
         using (var reader = new StreamReader(stream))
         {
             Debug.Write(reader.ReadToEnd());
         }
         writer.Dispose();
     }
 }
Exemplo n.º 3
0
        // ReSharper restore InconsistentNaming
        public FamilyTests()
        {
            kennedy = new Family();
            InitializePeople();

            john.Is.TheChildOf(rose, joseph);
            john.Is.MarriedTo(jackie)
                .AndTheyAreTheParentsOf(miscarriage, daughter1, daughter2, son1, son2);
            jackie.Is.MarriedTo(jackiesSecondHusband);
            joseph.Is.MarriedTo(rose)
                .AndTheyAreTheParentsOf(joe, rosemary, kathleen, eunice, pat, robert, jean, ted);
            kathleen.Is.MarriedTo(kathleensHusband);
            kathleen.Is.MarriedTo(kathleensSecondHusband);
            robert.Is.MarriedTo(ethyl)
                .AndTheyAreTheParentsOf(rdaughter1, rson1, rson2, rson3, rdaughter2, rson4, rdaugher3, rson5, rson6, rson7, rdaugher4);
            new[]{patrick, patricksWife}.AreTheParentsOf(joseph, pdaughter1, pdaughter2);
            fitz.Is.MarriedTo(mary)
                .AndTheyAreTheParentsOf(rose, fdaughter2, fson1, fson2, fdaughter3, fson3);
            gloria.Is.TheRomanticPartnerOf(joseph);
            toodles.Is.TheRomanticPartnerOf(fitz);
        }
Exemplo n.º 4
0
 public static Family Create()
 {
     var us = new Family();
     var me = new Woman
         {
             Name = "Subject Person",
             Generation = 1,
             DistanceToPrimaryLineage = 1,
             XPosition = 700
         };
     var sister = new Woman
         {
             Name = "Sister Person",
             Generation = 1,
             DistanceToPrimaryLineage = 2,
             XPosition = 525
         };
     var brother = new Man
         {
             Name = "Brother Person",
             Generation = 1,
             DistanceToPrimaryLineage = 2,
             XPosition = 850
         };
     var mom = new Woman
         {
             Name = "Mother Person",
             Generation = 2,
             DistanceToPrimaryLineage = 1,
             XPosition = 1050
         };
     var uncle = new Man
         {
             Name = "Mom's Brother",
             Generation = 2,
             DistanceToPrimaryLineage = 2,
             XPosition = 963
         };
     var uncleswife = new Woman
         {
             Name = "Uncle's Wife",
             Generation = 2,
             DistanceToPrimaryLineage = 3,
             XPosition = 1006
         };
     var dad = new Man
         {
             Name = "Father Person",
             Generation = 2,
             DistanceToPrimaryLineage = 1,
             XPosition = 350
         };
     var aunt = new Woman
         {
             Name = "Dad's Sister",
             Generation = 2,
             DistanceToPrimaryLineage = 2,
             XPosition = 438
         };
     var momsmom = new Woman
         {
             Name = "Maternal Grandmother",
             Generation = 3,
             DistanceToPrimaryLineage = 1,
             XPosition = 1225
         };
     var momsdad = new Man
         {
             Name = "Maternal Grandfather",
             Generation = 3,
             DistanceToPrimaryLineage = 1,
             XPosition = 875
         };
     var dadsmom = new Woman
         {
             Name = "Paternal Grandmother",
             Generation = 3,
             DistanceToPrimaryLineage = 1,
             XPosition = 525
         };
     var dadsdad = new Man
         {
             Name = "Paternal Grandfather",
             Generation = 3,
             DistanceToPrimaryLineage = 1,
             XPosition = 175
         };
     us.SetAsFamily(me, sister, brother, mom, dad, momsdad, momsmom, dadsdad, dadsmom, uncle, aunt, uncleswife);
     mom.Is.MarriedTo(dad).AndTheyAreTheParentsOf(me, sister, brother);
     momsdad.Is.MarriedTo(momsmom).AndTheyAreTheParentsOf(mom, uncle);
     dadsmom.Is.MarriedTo(dadsdad).AndTheyAreTheParentsOf(dad, aunt);
     uncle.Is.MarriedTo(uncleswife);
     return us;
 }
 public FamilyExtensionsTests()
 {
     _us = new Family();  _dad = _us.Add();  _mom = _us.Add();  _brother = _us.Add();  _sister = _us.Add();  _cat = _us.Add();
      _expectedChildren = new List<Person> { _brother, _sister, _cat };
 }