public void ShouldConvertServiceProjectIntoAProject() { var serviceProject = TranslatorHelper.CreateServiceProject(); var project = DataServiceTranslator.ConvertToProject(serviceProject); TranslatorHelper.AssertProject(serviceProject, project); }
/// <summary> /// Loads the project asynchronously. /// </summary> /// <param name="projectUri">The project URI.</param> public void LoadProjectAsync(Uri projectUri) { this.OnLoadProjectCompleted(new DataEventArgs <Project>(null, null)); if (projectUri == null) { return; } DataServiceClient client = this.CreateDataServiceClient(); client.LoadProjectCompleted += (sender, args) => { if (args.Error != null) { client.Abort(); this.logger.Log(this.GetType().Name, args.Error); if (args.Error.GetType() == typeof(Exception)) { throw args.Error; } return; } try { Project project = DataServiceTranslator.ConvertToProject(args.Result); this.OnLoadProjectCompleted(new DataEventArgs <Project>(project)); } catch (Exception e) { client.Abort(); this.logger.Log(this.GetType().Name, e); throw; } }; client.LoadProjectAsync(projectUri); }
public void ShouldReturnNullIfProjectContainerIsNull() { var result = DataServiceTranslator.ConvertToProject(null); Assert.IsNull(result); }