public void UpdateWithNull()
 {
     var workspaceID = Guid.NewGuid();
     var workspace = new Workspace(workspaceID);
     workspace.Update(null, false);
 }
        // TODO: Refactor file serialization handling into separate testable class

        #region Read

        private IWorkspace Read(Guid workdspaceID)
        {
            // force a lock on the file system ;)
            lock(WorkspaceLock)
            {
                var filePath = GetFileName(workdspaceID);
                var fileExists = File.Exists(filePath);
                using(var stream = File.Open(filePath, FileMode.OpenOrCreate))
                {
                    var formatter = new BinaryFormatter();
                    if(fileExists)
                    {
                        try
                        {
                            return (IWorkspace)formatter.Deserialize(stream);
                        }
                        // ReSharper disable EmptyGeneralCatchClause 
                        catch(Exception ex)
                        // ReSharper restore EmptyGeneralCatchClause
                        {
                            Dev2Logger.Log.Error(ex);
                            // Deserialization failed so overwrite with new one.
                        }
                    }

                    var result = new Workspace(workdspaceID);
                    formatter.Serialize(stream, result);
                    return result;
                }
            }
        }
 public void SaveWithNewWorkspaceIncreasesItemCountByOne()
 {
     Guid workspaceID;
     var repositoryInstance = SetupRepo(out workspaceID);
     var expected = repositoryInstance.Count + 1;
     Guid myGuid = Guid.NewGuid();
     var workspace = new Workspace(myGuid);
     repositoryInstance.Save(workspace);
     Assert.AreEqual(expected, repositoryInstance.Count);
 }