Skip to content

Commit

Permalink
Refactor tests & disable the test for the config binding generator
Browse files Browse the repository at this point in the history
  • Loading branch information
layomia committed Apr 9, 2023
1 parent 14dc074 commit 2391c08
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using System.Collections.Generic;
using System;
using Xunit.Abstractions;
using System.Runtime.InteropServices;
using Microsoft.NET.TestFramework.ProjectConstruction;

namespace Microsoft.NET.Build.Tests
Expand All @@ -32,14 +31,9 @@ public void It_resolves_offbydefaultgenerator_correctly(GeneratorSpec generator,
.WithSource()
.WithProjectChanges(project =>
{
var ns = project.Root.Name.Namespace;
if (isEnabled != null)
{
var ns = project.Root.Name.Namespace;
// Delete when we have a new targeting pack that contains Microsoft.Extensions.Configuration.Binder.SourceGeneration.
if (generator == GeneratorSpec.ConfigurationBinding)
{
project.Root.Add(new XElement(ns + "ItemGroup", new XElement("Analyzer", new XAttribute("Include", "does_not_yet_exist\\Microsoft.Extensions.Configuration.Binder.SourceGeneration.dll"))));
}
project.Root.Add(new XElement(ns + "PropertyGroup", new XElement(generator.EnablingPropertyName, isEnabled)));
}
});
Expand All @@ -57,11 +51,6 @@ public void It_enables_offbydefaultgenerator_for_PublishAot(GeneratorSpec genera
.WithProjectChanges(project =>
{
var ns = project.Root.Name.Namespace;
// Delete when we have a new targeting pack that contains Microsoft.Extensions.Configuration.Binder.SourceGeneration.
if (generator == GeneratorSpec.ConfigurationBinding)
{
project.Root.Add(new XElement(ns + "ItemGroup", new XElement("Analyzer", new XAttribute("Include", "does_not_yet_exist\\Microsoft.Extensions.Configuration.Binder.SourceGeneration.dll"))));
}
project.Root.Add(new XElement(ns + "PropertyGroup", new XElement("PublishAot", "true")));
});

Expand Down Expand Up @@ -96,7 +85,7 @@ public record GeneratorSpec(string EnablingPropertyName, string DllFileName)
public static IEnumerable<object[]> OffByDefaultGenerators()
{
yield return new object[] { GeneratorSpec.RequestDelegate };
yield return new object[] { GeneratorSpec.ConfigurationBinding };
// yield return new object[] { GeneratorSpec.ConfigurationBinding };
}

public static IEnumerable<object[]> OffByDefaultGeneratorTestData()
Expand Down

0 comments on commit 2391c08

Please sign in to comment.