99using FluentAssertions ;
1010using Xunit . Abstractions ;
1111using Microsoft . NET . TestFramework . ProjectConstruction ;
12- using System . Runtime . Versioning ;
1312
1413namespace Microsoft . NET . Build . Tests
1514{
@@ -40,14 +39,15 @@ public void WhenPropertiesAreSetItCanGenerateMinimumOSPlatformAttribute()
4039 var targetPlatformIdentifier = "iOS" ;
4140 testProject . AdditionalProperties [ "TargetPlatformIdentifier" ] = targetPlatformIdentifier ;
4241 testProject . AdditionalProperties [ "MinimumOSPlatform" ] = "13.2" ;
42+ testProject . AdditionalProperties [ "TargetPlatformVersion" ] = "14.0" ;
4343
4444 var testAsset = _testAssetsManager . CreateTestProject ( testProject ) ;
4545
4646 var runCommand = new DotnetCommand ( Log , "run" ) ;
4747 runCommand . WorkingDirectory = Path . Combine ( testAsset . TestRoot , testProject . Name ) ;
4848 runCommand . Execute ( )
4949 . Should ( )
50- . Pass ( ) . And . HaveStdOutContaining ( "PlatformName:ios13 .2" ) ;
50+ . Pass ( ) . And . HaveStdOutContaining ( "PlatformName:iOS13 .2" ) ;
5151 }
5252
5353 [ Fact ]
@@ -65,7 +65,7 @@ public void WhenMinimumOSPlatformISNotSetTargetPlatformVersionIsSetItCanGenerate
6565 runCommand . WorkingDirectory = Path . Combine ( testAsset . TestRoot , testProject . Name ) ;
6666 runCommand . Execute ( )
6767 . Should ( )
68- . Pass ( ) . And . HaveStdOutContaining ( "PlatformName:ios13 .2" ) ;
68+ . Pass ( ) . And . HaveStdOutContaining ( "PlatformName:iOS13 .2" ) ;
6969 }
7070
7171 private static TestProject SetUpProject ( )
@@ -79,7 +79,6 @@ private static TestProject SetUpProject()
7979 } ;
8080
8181 testProject . SourceFiles [ "PrintAttribute.cs" ] = _printAttribute ;
82- testProject . SourceFiles [ $ "AttributeIsNotDefinedYetWorkaround.cs"] = _attributeIsNotDefinedYetWorkaround ;
8382 return testProject ;
8483 }
8584
@@ -109,34 +108,5 @@ public static void Main()
109108}
110109" ;
111110
112- private static readonly string _attributeIsNotDefinedYetWorkaround = @"
113- namespace System.Runtime.Versioning
114- {
115- [AttributeUsage(AttributeTargets.Assembly |
116- AttributeTargets.Class |
117- AttributeTargets.Constructor |
118- AttributeTargets.Event |
119- AttributeTargets.Method |
120- AttributeTargets.Module |
121- AttributeTargets.Property |
122- AttributeTargets.Struct,
123- AllowMultiple = true, Inherited = false)]
124- public sealed class MinimumOSPlatformAttribute : OSPlatformAttribute
125- {
126- public MinimumOSPlatformAttribute(string platformName) : base(platformName)
127- {
128- }
129- }
130-
131- public abstract class OSPlatformAttribute : Attribute
132- {
133- private protected OSPlatformAttribute(string platformName)
134- {
135- PlatformName = platformName;
136- }
137- public string PlatformName { get; }
138- }
139- }" ;
140-
141111 }
142112}
0 commit comments