Beispiel #1
0
        public void MultipleRepositories_ShareDataStore()
        {
            new InMemoryPersonRepository().AddPeople(new List <Person>
            {
                new Person
                {
                    Gender        = Gender.Male,
                    DateOfBirth   = new DateTime(1983, 6, 2),
                    FavoriteColor = "Blue",
                    FirstName     = "Vamsi",
                    LastName      = "Nadimpalli"
                }
            });

            var people = new InMemoryPersonRepository().GetPeople();

            Assert.AreEqual(1, people.Count());

            var vamsi = people.ElementAt(0);

            Assert.AreEqual("Vamsi", vamsi.FirstName);
            Assert.AreEqual("Nadimpalli", vamsi.LastName);
            Assert.AreEqual("Blue", vamsi.FavoriteColor);
            Assert.AreEqual(Gender.Male, vamsi.Gender);
            Assert.AreEqual(new DateTime(1983, 6, 2), vamsi.DateOfBirth);
        }
Beispiel #2
0
        public void EmptyStore_GetPeople_ReturnsEmptyList()
        {
            var people = new InMemoryPersonRepository().GetPeople();

            Assert.AreEqual(0, people.Count());
        }