Esempio n. 1
0
        public async Task TestMethod1()
        {
            var dataToFilePersister = new DataToFilePersister(Context.Instance);

            var dataToSave = new List<Category>
                                 {
                                     new Category {Name = "test1"},
                                     new Category {Name = "test2"},
                                     new Category {Name = "test3"},
                                     new Category {Name = "test4"}
                                 };

            await dataToFilePersister.SaveLocalData(dataToSave, "Category.xml");

            await dataToFilePersister.InitializeData();
            Assert.IsNotNull(Context.Instance.Categories);
        }
        public async Task InitializeData_should_set_the_categories_in_the_context()
        {
            _dataToFilePersister = new DataToFilePersister(Context.Instance);

            var dataToSave = new List<Category>
                                 {
                                     new Category{ Name = "test1"},
                                     new Category{ Name = "test2"},
                                     new Category{ Name = "test3"},
                                     new Category{ Name = "test3"}
                                 };

            await _dataToFilePersister.SaveLocalData(dataToSave, "Category.xml");

            await _dataToFilePersister.InitializeData();
            Assert.IsNotNull(Context.Instance.Categories);
        }