SWFProcessing.Swiffotron.Test.MockStore.Has C# (CSharp) Method

Has() public method

public Has ( string id ) : bool
id string
return bool
        public bool Has(string id)
        {
            id = @"store\" + id;

            if (File.Exists(id))
            {
                if (this.commited.Contains(id))
                {
                    return true;
                }

                /* Oh dear.. the unit test will want to know about this... */
                throw new ApplicationException(@"Data was written but not commited.");
            }

            Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(
                    @"SWFProcessing.Swiffotron.Test.res.store." + id);

            return s != null;
        }

Usage Example

Example #1
0
 protected void CopyStoreToTestDir(MockStore store)
 {
     foreach (string commit in store.Commits)
     {
         if (store.Has(commit)) /* Well it might have been deleted */
         {
             using (Stream input = store.OpenInput(commit))
             using (FileStream output = new FileStream(TestDir + commit, FileMode.Create))
             {
                 CopyStream(input, output);
             }
         }
     }
 }
All Usage Examples Of SWFProcessing.Swiffotron.Test.MockStore::Has