LoadInstance() public method

public LoadInstance ( System.Guid instanceId, InstanceValue>.IDictionary &instanceData, InstanceValue>.IDictionary &instanceMetadata ) : System.Boolean
instanceId System.Guid
instanceData InstanceValue>.IDictionary
instanceMetadata InstanceValue>.IDictionary
return System.Boolean
        // ReSharper disable InconsistentNaming - Unit Tests
        public void LoadInstance_With_FileUsedByAnotherProcess_Expected_ThrowsInstancePersistenceException()
        // ReSharper restore InconsistentNaming
        {
            var instanceId = Guid.NewGuid();
            var path = Path.Combine(TestPath, instanceId + ".xml");
            var metaPath = Path.Combine(TestPath, instanceId + ".meta.xml");

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

                // 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();
                    IDictionary<XName, InstanceValue> instanceData;
                    IDictionary<XName, InstanceValue> instanceMetadata;

                    var result = store.LoadInstance(instanceId, out instanceData, out instanceMetadata);
                }
            }
            finally
            {
                if(File.Exists(path))
                {
                    File.Delete(path);
                }
                if(File.Exists(metaPath))
                {
                    File.Delete(metaPath);
                }
            }
        }