Exemplo n.º 1
0
        public void AddGetAndDeleteAndGetAgain()
        {
            ///
            /// Arrange and Insert new Student
            ///
            Student st = new Student("823648", "Ze Manel", "TLI41D");

            studentsDb.Add(new Dictionary <string, object>()
            {
                { "Number", st.Number },
                { "Name", st.Name },
                { "Classroom", st.Classroom },
            });
            ///
            /// Get newby Student
            ///
            var actual = studentsDb.GetById(st.Number);

            Assert.Equal(st.Name, actual["Name"]);
            Assert.Equal(st.Number, actual["Number"]);
            Assert.Equal(st.Classroom, actual["Classroom"]);
            ///
            /// Remove Student
            ///
            studentsDb.Delete(st.Number);
            Assert.Null(studentsDb.GetById(st.Number));
        }
        private static void Clear(FireDataSource source, string key)
        {
            IEnumerable <Dictionary <string, object> > docs = source.GetAll();

            foreach (var pairs in docs)
            {
                source.Delete(pairs[key]);
            }
        }