예제 #1
0
        static void Main(string[] args)
        {
            //Creates a instance of MockDataProvider so we can access the functions in it
            MockDataProvider dataProvider = new MockDataProvider();

            //Create a instance of Reporsitory so we can call the database function
            Reporsitory executor = new Reporsitory();

            //First it gets the results from dataProvider, and saves it all in the database.
            executor.Save((dataProvider.GetPeople(99)));
            //Calls a function to print all persons to the console
            PrintAll(executor.GetAll());
            //Wait for user to press any key on the keyboard
            Console.ReadKey();
        }
        public void List_WithValidCount_DB()
        {
            //arrange
            int ammount                 = 5;
            MockDataProvider data       = new MockDataProvider();
            Reporsitory      executor   = new Reporsitory();
            List <Person>    personList = new List <Person>();
            int expectedAmmount         = 0;

            //act
            personList      = data.GetPeople(ammount);
            expectedAmmount = personList.Count;
            executor.Save(personList);
            int actualAmmount = executor.GetAll().Count;

            //assert
            Assert.AreEqual(expectedAmmount, actualAmmount);
        }