Exemple #1
0
        public async Task EmptyAssetChecksumTest()
        {
            var document   = new AdhocWorkspace().CurrentSolution.AddProject("empty", "empty", LanguageNames.CSharp).AddDocument("empty", SourceText.From(""));
            var serializer = new Serializer(document.Project.Solution);

            var source   = serializer.CreateChecksum(await document.GetTextAsync().ConfigureAwait(false), CancellationToken.None);
            var metadata = serializer.CreateChecksum(new MissingMetadataReference(), CancellationToken.None);
            var analyzer = serializer.CreateChecksum(new AnalyzerFileReference("missing", new MissingAnalyzerLoader()), CancellationToken.None);

            Assert.NotEqual(source, metadata);
            Assert.NotEqual(source, analyzer);
            Assert.NotEqual(metadata, analyzer);
        }
Exemple #2
0
        public void EmptyAssetChecksumTest()
        {
            var document     = new AdhocWorkspace().CurrentSolution.AddProject("empty", "empty", LanguageNames.CSharp).AddDocument("empty", SourceText.From(""));
            var assetBuilder = new AssetBuilder(document.Project.Solution);

            var source   = assetBuilder.Build(document.State, document.GetTextAsync().Result, CancellationToken.None);
            var metadata = assetBuilder.Build(new MissingMetadataReference(), CancellationToken.None);
            var analyzer = assetBuilder.Build(new AnalyzerFileReference("missing", new MissingAnalyzerLoader()), CancellationToken.None);

            Assert.NotEqual(source.Checksum, metadata.Checksum);
            Assert.NotEqual(source.Checksum, analyzer.Checksum);
            Assert.NotEqual(metadata.Checksum, analyzer.Checksum);
        }
        public async Task EmptyAssetChecksumTest()
        {
            var document = new AdhocWorkspace().CurrentSolution.AddProject("empty", "empty", LanguageNames.CSharp).AddDocument("empty", SourceText.From(""));
            var serializer = new Serializer(document.Project.Solution.Workspace.Services);

            var source = serializer.CreateChecksum(await document.GetTextAsync().ConfigureAwait(false), CancellationToken.None);
            var metadata = serializer.CreateChecksum(new MissingMetadataReference(), CancellationToken.None);
            var analyzer = serializer.CreateChecksum(new AnalyzerFileReference("missing", new MissingAnalyzerLoader()), CancellationToken.None);

            Assert.NotEqual(source, metadata);
            Assert.NotEqual(source, analyzer);
            Assert.NotEqual(metadata, analyzer);
        }
        public void EmptyAssetChecksumTest()
        {
            var document = new AdhocWorkspace().CurrentSolution.AddProject("empty", "empty", LanguageNames.CSharp).AddDocument("empty", SourceText.From(""));
            var assetBuilder = new AssetBuilder(document.Project.Solution);

            var source = assetBuilder.Build(document.State, document.GetTextAsync().Result, CancellationToken.None);
            var metadata = assetBuilder.Build(new MissingMetadataReference(), CancellationToken.None);
            var analyzer = assetBuilder.Build(new AnalyzerFileReference("missing", new MissingAnalyzerLoader()), CancellationToken.None);

            Assert.NotEqual(source.Checksum, metadata.Checksum);
            Assert.NotEqual(source.Checksum, analyzer.Checksum);
            Assert.NotEqual(metadata.Checksum, analyzer.Checksum);
        }