Exemplo n.º 1
0
        public void TestUpload()
        {
            var test_storage = new TestStorage();
            var model = new GuiModel(test_storage);

            model.Connect();

            List<string> h_file_1 = new List<string>{ "hierarchy file one" };
            List<string> h_file_2 = new List<string>{ "hierarchy file two" };
            const string path_file_1 = "path file one";
            const string path_file_2 = "path file two";

            model.AddFileToUpload( h_file_1, path_file_1 );
            model.AddFileToUpload( h_file_2, path_file_2 );

            Assert.IsNull(test_storage.files_to_upload);

            model.Upload();

            Assert.AreEqual(2, test_storage.files_to_upload.Count );

            var test_so_1 = new StorageObject(h_file_1, path_file_1);
            var test_so_2 = new StorageObject(h_file_2, path_file_2);

            Assert.IsTrue(test_storage.files_to_upload.Exists( e => e.Equals(test_so_1) ) );
            Assert.IsTrue(test_storage.files_to_upload.Exists( e => e.Equals(test_so_2) ) );

            model.Upload();
            Assert.AreEqual(0, test_storage.files_to_upload.Count);
        }