public async Task Workspace_RoundTrip_Test_Desktop() { var hostServices = MefHostServices.Create( MefHostServices.DefaultAssemblies.Add(typeof(TemporaryStorageServiceFactory.TemporaryStorageService).Assembly)); using var workspace = new AdhocWorkspace(hostServices); var solution = CreateFullSolution(workspace); var validator = new SerializationValidator(workspace.Services); using var snapshot1 = await validator.RemotableDataService.CreatePinnedRemotableDataScopeAsync(solution, CancellationToken.None).ConfigureAwait(false); // recover solution from given snapshot var recovered = await validator.GetSolutionAsync(snapshot1).ConfigureAwait(false); var solutionObject1 = await validator.GetValueAsync <SolutionStateChecksums>(snapshot1.SolutionChecksum).ConfigureAwait(false); // create new snapshot from recovered solution using var snapshot2 = await validator.RemotableDataService.CreatePinnedRemotableDataScopeAsync(recovered, CancellationToken.None).ConfigureAwait(false); // verify asset created by recovered solution is good var solutionObject2 = await validator.GetValueAsync <SolutionStateChecksums>(snapshot2.SolutionChecksum).ConfigureAwait(false); await validator.VerifyAssetAsync(solutionObject2).ConfigureAwait(false); // verify snapshots created from original solution and recovered solution are same validator.SolutionStateEqual(solutionObject1, solutionObject2); snapshot1.Dispose(); // recover new solution from recovered solution var roundtrip = await validator.GetSolutionAsync(snapshot2).ConfigureAwait(false); // create new snapshot from round tripped solution using var snapshot3 = await validator.RemotableDataService.CreatePinnedRemotableDataScopeAsync(roundtrip, CancellationToken.None).ConfigureAwait(false); // verify asset created by rount trip solution is good var solutionObject3 = await validator.GetValueAsync <SolutionStateChecksums>(snapshot3.SolutionChecksum).ConfigureAwait(false); await validator.VerifyAssetAsync(solutionObject3).ConfigureAwait(false); // verify snapshots created from original solution and round trip solution are same. validator.SolutionStateEqual(solutionObject2, solutionObject3); snapshot2.Dispose(); }
public async Task CreateSolutionSnapshotId_Full_Asset_Serialization_Desktop() { using var workspace = new AdhocWorkspace(); var solution = CreateFullSolution(workspace); var validator = new SerializationValidator(workspace.Services); using var snapshot = await validator.RemotableDataService.CreatePinnedRemotableDataScopeAsync(solution, CancellationToken.None).ConfigureAwait(false); var solutionObject = await validator.GetValueAsync <SolutionStateChecksums>(snapshot.SolutionChecksum); await validator.VerifyAssetAsync(solutionObject).ConfigureAwait(false); }
public async Task CreateSolutionSnapshotId_Full_Asset_Serialization_Desktop() { var hostServices = MefHostServices.Create( MefHostServices.DefaultAssemblies.Add(typeof(TemporaryStorageServiceFactory.TemporaryStorageService).Assembly)); using var workspace = new AdhocWorkspace(hostServices); var solution = CreateFullSolution(workspace); var validator = new SerializationValidator(workspace.Services); using var snapshot = await validator.RemotableDataService.CreatePinnedRemotableDataScopeAsync(solution, CancellationToken.None).ConfigureAwait(false); var solutionObject = await validator.GetValueAsync <SolutionStateChecksums>(snapshot.SolutionChecksum); await validator.VerifyAssetAsync(solutionObject).ConfigureAwait(false); }