예제 #1
0
        public void AddingExistingPersonShouldThrowException()
        {
            IPersonStore personStore = new PersonStore();

            personStore.AddPerson("Name", Gender.Male);
            Action act = () => personStore.AddPerson("Name", Gender.Male);

            act.Should().Throw <ArgumentException>();
        }
예제 #2
0
        public void AddingMultiplePersonShouldGenerateValidIds()
        {
            IPersonStore personStore = new PersonStore();
            var          person1     = personStore.AddPerson("Name1", Gender.Male);
            var          person2     = personStore.AddPerson("Name2", Gender.Male);
            var          person3     = personStore.AddPerson("Name3", Gender.Male);

            person1.Id.Should().Be(1);
            person2.Id.Should().Be(2);
            person3.Id.Should().Be(3);
        }
예제 #3
0
        public void AddNewPerson()
        {
            IPersonStore personStore = new PersonStore();

            personStore.AddPerson("Name", Gender.Male);
            var actual = personStore.ContainsPerson("Name");

            actual.Should().Be(true);
        }
예제 #4
0
 public CreatePersonViewModel()
 {
     Create = new RelayCommand(async() =>
     {
         ClearInput = false;
         var person = new Person
         {
             FirstName  = FirstName,
             LastName   = LastName,
             MiddleName = MiddleName
         };
         await PersonStore.AddPerson(person);
         App.Persons.Add(person);
         ClearInput = true;
     });
 }
예제 #5
0
 public void AddPerson([DataBind("Person")] Person p)
 {
     PersonStore.AddPerson(p);
     RedirectToAction("Index");
 }
예제 #6
0
        public void SetUp()
        {
            IPersonStore PersonStore = new PersonStore();

            george                = PersonStore.AddPerson("George", Gender.Male);
            mary                  = PersonStore.AddPerson("Mary", Gender.Female);
            bob                   = PersonStore.AddPerson("Bob", Gender.Male);
            sally                 = PersonStore.AddPerson("Sally", Gender.Female);
            dave                  = PersonStore.AddPerson("Dave", Gender.Male);
            davesMaternalUncle    = PersonStore.AddPerson("Hulk", Gender.Male);
            davesPaternalAunt     = PersonStore.AddPerson("Aunt", Gender.Female);
            davesMaternalGrandDad = PersonStore.AddPerson("Thor", Gender.Male);
            davesMaternalGrandMom = PersonStore.AddPerson("Wonder", Gender.Female);
            davesPaternalGrandDad = PersonStore.AddPerson("Thor1", Gender.Male);
            davesPaternalGrandMom = PersonStore.AddPerson("Wonder1", Gender.Female);

            amy          = PersonStore.AddPerson("Amy", Gender.Female);
            bamy         = PersonStore.AddPerson("Bamy", Gender.Female);
            miller       = PersonStore.AddPerson("Miller", Gender.Male);
            amysBrother  = PersonStore.AddPerson("BigB", Gender.Male);
            amysBrother1 = PersonStore.AddPerson("ABig", Gender.Male);
            amysMom      = PersonStore.AddPerson("Miley", Gender.Female);
            amysDad      = PersonStore.AddPerson("Brad", Gender.Male);

            FamilyGraph familyGraph = new FamilyGraph(PersonStore);

            //Daves Family
            familyGraph.AddRelationship("Thor", "Mary", "Parent");
            familyGraph.AddRelationship("Wonder", "Mary", "Parent");
            familyGraph.AddRelationship("Thor", "Hulk", "Parent");
            familyGraph.AddRelationship("Wonder", "Hulk", "Parent");

            familyGraph.AddRelationship("Thor1", "George", "Parent");
            familyGraph.AddRelationship("Wonder1", "George", "Parent");
            familyGraph.AddRelationship("Thor1", "Aunt", "Parent");
            familyGraph.AddRelationship("Wonder1", "Aunt", "Parent");

            familyGraph.AddRelationship("George", "Bob", "Parent");
            familyGraph.AddRelationship("Mary", "Bob", "Parent");
            familyGraph.AddRelationship("George", "Dave", "Parent");
            familyGraph.AddRelationship("Mary", "Dave", "Parent");
            familyGraph.AddRelationship("George", "Sally", "Parent");
            familyGraph.AddRelationship("Mary", "Sally", "Parent");


            //Spouse
            familyGraph.AddRelationship("Dave", "Amy", "Spouse");

            //Amy's Family
            familyGraph.AddRelationship("Brad", "Miller", "Parent");
            familyGraph.AddRelationship("Miley", "Miller", "Parent");
            familyGraph.AddRelationship("Brad", "ABig", "Parent");
            familyGraph.AddRelationship("Miley", "ABig", "Parent");
            familyGraph.AddRelationship("Brad", "BigB", "Parent");
            familyGraph.AddRelationship("Miley", "BigB", "Parent");
            familyGraph.AddRelationship("Brad", "Amy", "Parent");
            familyGraph.AddRelationship("Miley", "Amy", "Parent");
            familyGraph.AddRelationship("Brad", "Bamy", "Parent");
            familyGraph.AddRelationship("Miley", "Bamy", "Parent");

            relationships = new Relationships(familyGraph);
        }