SaveAllInstanceMetaData() public method

Saves all instance meta data.
public SaveAllInstanceMetaData ( System.Guid instanceId, System.Activities.DurableInstancing.SaveWorkflowCommand command ) : void
instanceId System.Guid The instance id.
command System.Activities.DurableInstancing.SaveWorkflowCommand The command.
return void
        // ReSharper disable InconsistentNaming - Unit Tests
        public void SaveAllInstanceMetaData_With_FileUsedByAnotherProcess_Expected_ThrowsInstancePersistenceException()
        // ReSharper restore InconsistentNaming
        {
            var instanceId = Guid.NewGuid();
            var path = Path.Combine(TestPath, instanceId + ".meta.xml");

            try
            {
                var xml = XmlResource.Fetch(TestMetaFileName);
                xml.Save(path);

                // Force error: The process cannot access the file because it is being used by another process
                using(var fs = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.None))
                {
                    var store = new FileSystemInstanceStoreIO();
                    store.SaveAllInstanceMetaData(instanceId, new SaveWorkflowCommand());
                }
            }
            finally
            {
                if(File.Exists(path))
                {
                    File.Delete(path);
                }
            }
        }