~ubuntu-branches/ubuntu/hardy/tomboy/hardy

« back to all changes in this revision

Viewing changes to Tomboy/Addins/FileSystemSyncService/FileSystemSyncServiceAddin.cs

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2007-09-10 21:50:30 UTC
  • mfrom: (1.1.26 upstream)
  • Revision ID: james.westby@ubuntu.com-20070910215030-zsyd2ddfnizeyviq
Tags: 0.7.7-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
                                        throw new TomboySyncException (Catalog.GetString ("Specified folder path does not exist, " +
154
154
                                                                                          "and Tomboy was unable to create it."));
155
155
                                }
 
156
                        } else {
 
157
                                // Test creating/writing/deleting a file
 
158
                                // FIXME: Should throw TomboySyncException once string changes are OK again
 
159
                                string testPathBase = Path.Combine (syncPath, "test");
 
160
                                string testPath = testPathBase;
 
161
                                int count = 0;
 
162
                                
 
163
                                // Get unique new file name
 
164
                                while (File.Exists (testPath))
 
165
                                        testPath = testPathBase + (++count).ToString ();
 
166
                                
 
167
                                // Test ability to create and write
 
168
                                string testLine = "Testing write capabilities.";
 
169
                                using (FileStream fs = File.Create (testPath)) {
 
170
                                        StreamWriter writer = new StreamWriter (fs);
 
171
                                        writer.WriteLine (testLine);
 
172
                                }
 
173
                                
 
174
                                // Test ability to read
 
175
                                bool testFileFound = false;
 
176
                                foreach (string filePath in Directory.GetFiles (syncPath))
 
177
                                        if (filePath == testPath) {
 
178
                                                testFileFound = true;
 
179
                                                break;
 
180
                                        }
 
181
                                if (!testFileFound)
 
182
                                        ; // TODO: Throw TomboySyncException
 
183
                                using (StreamReader reader = new StreamReader (testPath)) {
 
184
                                        if (reader.ReadLine () != testLine)
 
185
                                                ; // TODO: Throw TomboySyncException
 
186
                                }
 
187
                                
 
188
                                // Test ability to delete
 
189
                                File.Delete (testPath);
156
190
                        }
157
191
                        
158
192
                        path = syncPath;