Esempio n. 1
0
        public async Task TestSolutionSynchronization()
        {
            var code = @"class Test { void Method() { } }";

            using var workspace = TestWorkspace.CreateCSharp(code);
            var solution = workspace.CurrentSolution;

            // build checksum
            await solution.State.GetChecksumAsync(CancellationToken.None);

            var map = await solution.GetAssetMapAsync(CancellationToken.None);

            using var remoteWorkspace = CreateRemoteWorkspace();

            var sessionId   = 0;
            var storage     = new SolutionAssetCache();
            var assetSource = new SimpleAssetSource(
                workspace.Services.GetService <ISerializerService>(),
                map
                );

            var service = new AssetProvider(
                sessionId,
                storage,
                assetSource,
                remoteWorkspace.Services.GetService <ISerializerService>()
                );
            await service.SynchronizeSolutionAssetsAsync(
                await solution.State.GetChecksumAsync(CancellationToken.None),
                CancellationToken.None
                );

            TestUtils.VerifyAssetStorage(map, storage);
        }