Skip to content

Commit ddd698f

Browse files
committed
feat: allow filtering for required platforms
1 parent 3f0e7d4 commit ddd698f

File tree

31 files changed

+672
-212
lines changed

31 files changed

+672
-212
lines changed

E2E/Directory.Build.props

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44

55
<PropertyGroup Condition=" '$(PIPELINE_WORKSPACE)' != '' ">
66
<CIArtifactsDirectory>$([System.IO.Path]::Combine('$(PIPELINE_WORKSPACE)', 'Artifacts'))</CIArtifactsDirectory>
7-
<GeneratedLocalPackage>$([System.IO.Directory]::GetFiles('$(CIArtifactsDirectory)', 'Mobile.BuildTools.2.*.nupkg')[0])</GeneratedLocalPackage>
7+
<GeneratedLocalPackage>$([System.IO.Directory]::GetFiles('$(CIArtifactsDirectory)', 'Mobile.BuildTools.AppSettings.2.*.nupkg')[0])</GeneratedLocalPackage>
88
</PropertyGroup>
99
<PropertyGroup Condition=" '$(PIPELINE_WORKSPACE)' == '' ">
10-
<GeneratedLocalPackage>$([System.IO.Directory]::GetFiles('$(LocalArtifactStagingDirectory)', 'Mobile.BuildTools.2.*.nupkg')[0])</GeneratedLocalPackage>
10+
<GeneratedLocalPackage>$([System.IO.Directory]::GetFiles('$(LocalArtifactStagingDirectory)', 'Mobile.BuildTools.AppSettings.2.*.nupkg')[0])</GeneratedLocalPackage>
1111
</PropertyGroup>
1212

1313
<PropertyGroup>
14+
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
1415
<GenerateLocalPackageFileName>$([System.IO.Path]::GetFileNameWithoutExtension('$(GeneratedLocalPackage)'))</GenerateLocalPackageFileName>
15-
<GeneratedPackageVersion>$(GenerateLocalPackageFileName.Replace('Mobile.BuildTools.', ''))</GeneratedPackageVersion>
16+
<GeneratedPackageVersion>$(GenerateLocalPackageFileName.Replace('Mobile.BuildTools.AppSettings.', ''))</GeneratedPackageVersion>
1617
</PropertyGroup>
1718

1819
<ItemGroup>
19-
<PackageReference Include="Mobile.BuildTools" VersionOverride="$(GeneratedPackageVersion)" PrivateAssets="all" />
20-
<PackageReference Include="Mobile.BuildTools.Configuration" VersionOverride="$(GeneratedPackageVersion)" />
20+
<PackageReference Include="Mobile.BuildTools.AppSettings" VersionOverride="$(GeneratedPackageVersion)" PrivateAssets="all" />
21+
<PackageReference Include="Mobile.BuildTools.Core" VersionOverride="$(GeneratedPackageVersion)" PrivateAssets="all" />
2122
</ItemGroup>
2223

23-
</Project>
24+
</Project>

E2E/E2E.Core/E2E.Core.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,4 @@
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

8-
<ItemGroup>
9-
<PackageReference Include="Xamarin.Forms" />
10-
</ItemGroup>
11-
128
</Project>

E2E/E2E.Core/Views/DemoPage.xaml

-13
This file was deleted.

E2E/E2E.Core/Views/DemoPage.xaml.cs

-16
This file was deleted.

E2E/E2E.Tests/E2E.Tests.csproj

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<MobileBuildToolsDebug>true</MobileBuildToolsDebug>
77
</PropertyGroup>
@@ -10,10 +10,8 @@
1010

1111
<ItemGroup>
1212
<PackageReference Include="Microsoft.NET.Test.Sdk" />
13-
<PackageReference Include="Xamarin.Forms" />
1413
<PackageReference Include="xunit" />
1514
<PackageReference Include="xunit.runner.visualstudio" />
16-
<PackageReference Include="Xamarin.Forms.Mocks" />
1715
</ItemGroup>
1816

1917
<ItemGroup>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
using System;
2+
using E2E.Tests.Helpers;
3+
using Xunit;
4+
5+
namespace E2E.Tests.Fixtures
6+
{
7+
public class AppSettingsFixture
8+
{
9+
[Fact]
10+
public void AStringIsOfTypeString()
11+
{
12+
Assert.IsType<string>(AppSettings.AString);
13+
Assert.Equal("Hello World!", AppSettings.AString);
14+
}
15+
16+
[Fact]
17+
public void AnIntIsOfTypeInt()
18+
{
19+
Assert.IsType<int>(AppSettings.AnInt);
20+
Assert.Equal(5, AppSettings.AnInt);
21+
}
22+
23+
[Fact]
24+
public void ADoubleIsOfTypeDouble()
25+
{
26+
Assert.IsType<double>(AppSettings.ADouble);
27+
Assert.Equal(3.14, AppSettings.ADouble);
28+
}
29+
30+
[Fact]
31+
public void ABoolIsOfTypeBool()
32+
{
33+
Assert.IsType<bool>(AppSettings.ABool);
34+
Assert.False(AppSettings.ABool);
35+
}
36+
37+
[Fact]
38+
public void AFloatIsOfTypeFloat()
39+
{
40+
Assert.IsType<float>(AppSettings.AFloat);
41+
Assert.Equal(4.2F, AppSettings.AFloat);
42+
}
43+
44+
[Fact]
45+
public void ADateIsOfTypeDateTime()
46+
{
47+
Assert.IsType<DateTime>(AppSettings.ADate);
48+
Assert.Equal(DateTime.Parse("January 1, 2020"), AppSettings.ADate);
49+
}
50+
51+
[Fact]
52+
public void AUriIsOfTypeUri()
53+
{
54+
Assert.IsType<Uri>(AppSettings.AUri);
55+
Assert.Equal(new Uri("https://mobilebuildtools.com"), AppSettings.AUri);
56+
}
57+
58+
[Fact]
59+
public void AStringArrayHas3Elements()
60+
{
61+
Assert.Equal(3, AppSettings.AStringArray.Length);
62+
Assert.Contains("Foo", AppSettings.AStringArray);
63+
Assert.Contains("Bar", AppSettings.AStringArray);
64+
Assert.Contains("Baz", AppSettings.AStringArray);
65+
}
66+
67+
[Fact]
68+
public void AStringArrayIsOfTypeStringArray()
69+
{
70+
Assert.IsType<string[]>(AppSettings.AStringArray);
71+
Assert.Equal(3, AppSettings.AStringArray.Length);
72+
}
73+
74+
[Fact]
75+
public void AppCenterSecretIsNull()
76+
{
77+
Assert.Null(AppSettings.AppCenterSecret);
78+
}
79+
80+
[Fact]
81+
public void SomeDefaultBoolIsFalse()
82+
{
83+
Assert.IsType<bool>(AppSettings.SomeDefaultBool);
84+
Assert.False(AppSettings.SomeDefaultBool);
85+
}
86+
87+
[Fact]
88+
public void DoesNotGeneratePlatformSpecificProperty()
89+
{
90+
var type = typeof(AppSettings);
91+
var property = type.GetProperty("APlatformProperty");
92+
Assert.Null(property);
93+
}
94+
}
95+
}
+45-45
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Reflection;
6-
using E2E.Core;
7-
using Xunit;
1+
// using System;
2+
// using System.Collections.Generic;
3+
// using System.IO;
4+
// using System.Linq;
5+
// using System.Reflection;
6+
// using E2E.Core;
7+
// using Xunit;
88

9-
namespace E2E.Tests.Fixtures
10-
{
11-
public class SCSSToCSSFixture
12-
{
13-
public const string ExpectedCSSResourceId = "E2E.Core.theme.style.css";
14-
public const string SecondaryExpectedCSSResourceId = "E2E.Core.theme.anotherStyle.css";
15-
public const string ExpectedCSS = @".primaryButton{background-color:#006}^button{background-color:transparent}";
9+
// namespace E2E.Tests.Fixtures
10+
// {
11+
// public class SCSSToCSSFixture
12+
// {
13+
// public const string ExpectedCSSResourceId = "E2E.Core.theme.style.css";
14+
// public const string SecondaryExpectedCSSResourceId = "E2E.Core.theme.anotherStyle.css";
15+
// public const string ExpectedCSS = @".primaryButton{background-color:#006}^button{background-color:transparent}";
1616

17-
[Fact]
18-
public void CssIsEmbedded()
19-
{
20-
Assert.NotEmpty(CommonLib.GetManifestResourceNames());
21-
Assert.Contains(ExpectedCSSResourceId, CommonLib.GetManifestResourceNames());
22-
}
17+
// [Fact]
18+
// public void CssIsEmbedded()
19+
// {
20+
// Assert.NotEmpty(CommonLib.GetManifestResourceNames());
21+
// Assert.Contains(ExpectedCSSResourceId, CommonLib.GetManifestResourceNames());
22+
// }
2323

24-
[Fact]
25-
public void SecondaryCssIsEmbedded()
26-
{
27-
Assert.Contains(SecondaryExpectedCSSResourceId, CommonLib.GetManifestResourceNames());
28-
}
24+
// [Fact]
25+
// public void SecondaryCssIsEmbedded()
26+
// {
27+
// Assert.Contains(SecondaryExpectedCSSResourceId, CommonLib.GetManifestResourceNames());
28+
// }
2929

30-
[Fact]
31-
public void CssWasProperlyFormatted()
32-
{
33-
using (var stream = typeof(CommonLib).Assembly.GetManifestResourceStream(ExpectedCSSResourceId))
34-
using (var reader = new StreamReader(stream))
35-
{
36-
Assert.NotNull(stream);
37-
var css = reader.ReadLine();
38-
Assert.Equal(ExpectedCSS, css);
39-
}
40-
}
30+
// [Fact]
31+
// public void CssWasProperlyFormatted()
32+
// {
33+
// using (var stream = typeof(CommonLib).Assembly.GetManifestResourceStream(ExpectedCSSResourceId))
34+
// using (var reader = new StreamReader(stream))
35+
// {
36+
// Assert.NotNull(stream);
37+
// var css = reader.ReadLine();
38+
// Assert.Equal(ExpectedCSS, css);
39+
// }
40+
// }
4141

42-
[Fact]
43-
public void SCSSIsNotEmbedded()
44-
{
45-
Assert.Empty(EmbeddedResources().Where(r => r.EndsWith(".scss", StringComparison.InvariantCultureIgnoreCase)));
46-
}
42+
// [Fact]
43+
// public void SCSSIsNotEmbedded()
44+
// {
45+
// Assert.Empty(EmbeddedResources().Where(r => r.EndsWith(".scss", StringComparison.InvariantCultureIgnoreCase)));
46+
// }
4747

48-
private IEnumerable<string> EmbeddedResources() =>
49-
GetType().Assembly.GetManifestResourceNames();
50-
}
51-
}
48+
// private IEnumerable<string> EmbeddedResources() =>
49+
// GetType().Assembly.GetManifestResourceNames();
50+
// }
51+
// }

E2E/E2E.Tests/Fixtures/SecretsFixture.cs

-76
This file was deleted.

0 commit comments

Comments
 (0)