Revert "[Tests]Update to Xamarin.UITest 3.0 and NUnit 3.0 (#6332)" (#7021)

This reverts commit fbebbfc516.
This commit is contained in:
Shane Neuville 2019-07-31 04:08:17 -06:00 коммит произвёл Gerald Versluis
Родитель 5d010511c6
Коммит cd3d7afefc
33 изменённых файлов: 121 добавлений и 164 удалений

Просмотреть файл

@ -349,7 +349,7 @@
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.Insights" Version="1.12.3" />
<PackageReference Include="Xamarin.iOS.MaterialComponents" Version="72.2.0.1" />
<PackageReference Include="Xamarin.TestCloud.Agent" Version="0.21.8" />
<PackageReference Include="Xamarin.TestCloud.Agent" Version="0.21.7" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />

Просмотреть файл

@ -45,7 +45,7 @@ namespace Xamarin.Forms.Controls.Issues
#if UITEST && __IOS__
[Test]
[Category(UITestCategories.ManualReview)]
[Ignore("Fails sometimes")]
[Ignore]
public void Bugzilla35736Test()
{
RunningApp.WaitForElement(q => q.Marked("Bugzilla35736Editor"));

Просмотреть файл

@ -236,7 +236,9 @@ namespace Xamarin.Forms.Controls
public void SwipeRight()
{
SwipeLeftToRight();
#pragma warning disable 618
_app.SwipeRight();
#pragma warning restore 618
}
public void SwipeLeftToRight(double swipePercentage = 0.67, int swipeSpeed = 500, bool withInertia = true)
@ -251,7 +253,9 @@ namespace Xamarin.Forms.Controls
public void SwipeLeft()
{
SwipeRightToLeft();
#pragma warning disable 618
_app.SwipeLeft();
#pragma warning restore 618
}
public void SwipeRightToLeft(double swipePercentage = 0.67, int swipeSpeed = 500, bool withInertia = true)

Просмотреть файл

@ -696,7 +696,7 @@ namespace Xamarin.Forms.Controls.Issues
[SetUpFixture]
public class IssuesSetup
{
[OneTimeSetUp]
[SetUp]
public void RunBeforeAnyTests()
{
AppSetup.RunningApp = AppSetup.Setup(null);

Просмотреть файл

@ -1256,7 +1256,7 @@
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)_TemplateMarkup.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue5801.xaml">
<SubType>Designer</SubType>

Просмотреть файл

@ -46,12 +46,12 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.UITest" Version="3.0.0" />
<PackageReference Include="NUnit3TestAdapter">
<Version>3.13.0</Version>
<PackageReference Include="NUnit" Version="2.6.4" />
<PackageReference Include="NUnitTestAdapter">
<Version>2.1.1</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.UITest" Version="2.2.7" />
</ItemGroup>
<ItemGroup>
<Compile Include="BaseViewContainerRemoteAndroid.cs" />
@ -87,7 +87,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="_CopyXamarinUITestFiles" AfterTargets="Build">
<ItemGroup>
<_XamarinUITestFiles Include="$(NuGetPackageRoot)Xamarin.UITest\%(Version)\**" Condition="@(PackageReference -&gt; '%(Identity)') == 'Xamarin.UITest'" InProject="False" />
<_XamarinUITestFiles Include="$(NuGetPackageRoot)Xamarin.UITest\%(Version)\**" Condition="@(PackageReference -> '%(Identity)') == 'Xamarin.UITest'" InProject="False" />
</ItemGroup>
<Copy SourceFiles="@(_XamarinUITestFiles)" DestinationFolder="$(SolutionDir)packages\Xamarin.UITest.AnyVersion\%(RecursiveDir)" ContinueOnError="true" Retries="0" />
</Target>

Просмотреть файл

@ -17,7 +17,7 @@ namespace Xamarin.Forms.Core.UITests
public static AppRect ScreenBounds { get; set; }
[OneTimeTearDown]
[TestFixtureTearDown]
protected virtual void FixtureTeardown()
{
}
@ -45,7 +45,7 @@ namespace Xamarin.Forms.Core.UITests
[SetUp]
protected virtual void TestSetup()
{
//EnsureMemory();
EnsureMemory();
}
[TearDown]
@ -55,7 +55,9 @@ namespace Xamarin.Forms.Core.UITests
protected abstract void NavigateToGallery();
[OneTimeSetUp]
#pragma warning disable 618
[TestFixtureSetUp]
#pragma warning restore 618
protected virtual void FixtureSetup()
{
ResetApp();
@ -109,6 +111,7 @@ namespace Xamarin.Forms.Core.UITests
}
}
}
#if UITEST
namespace Xamarin.Forms.Core.UITests
@ -118,7 +121,7 @@ namespace Xamarin.Forms.Core.UITests
[SetUpFixture]
public class CoreUITestsSetup
{
[OneTimeSetUp]
[SetUp]
public void RunBeforeAnyTests()
{
LaunchApp();
@ -135,4 +138,4 @@ namespace Xamarin.Forms.Core.UITests
}
}
#endif
#endif

Просмотреть файл

@ -8,7 +8,7 @@ namespace Xamarin.Forms.Core.UnitTests
{
[Test]
//https://bugzilla.xamarin.com/show_bug.cgi?id=51424
public async Task AnimationRepeats()
public async void AnimationRepeats()
{
var box = new BoxView();
Assume.That(box.Rotation, Is.EqualTo(0d));

Просмотреть файл

@ -1588,7 +1588,7 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.That (() => bindable.SetBinding (MockBindable.TextProperty, new Binding ("Text2")), Throws.Nothing);
Assert.That (bindable.Text, Is.EqualTo (MockBindable.TextProperty.DefaultValue));
Assert.That (log.Messages.Count, Is.EqualTo (1), "An error was not logged");
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"Text2",
"Xamarin.Forms.Core.UnitTests.BindingUnitTests+DifferentViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
@ -1607,7 +1607,7 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.That (bindable.Text, Is.EqualTo ("Foo"));
Assert.That (log.Messages.Count, Is.Not.GreaterThan (1), "Too many errors were logged");
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"Text",
"Xamarin.Forms.Core.UnitTests.BindingUnitTests+EmptyViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
@ -1621,7 +1621,7 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.That (() => bindable.SetBinding (MockBindable.TextProperty, new Binding ("Text")), Throws.Nothing);
Assert.That (log.Messages.Count, Is.EqualTo (1), "An error was not logged");
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"Text",
"Xamarin.Forms.Core.UnitTests.BindingUnitTests+DifferentViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
@ -1637,7 +1637,7 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.That (() => bindable.SetBinding (MockBindable.TextProperty, new Binding ("PrivateSetter")), Throws.Nothing);
Assert.That (log.Messages.Count, Is.EqualTo (1), "An error was not logged");
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"PrivateSetter",
"Xamarin.Forms.Core.UnitTests.BindingUnitTests+DifferentViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
@ -1646,7 +1646,7 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.That (() => bindable.SetValueCore (MockBindable.TextProperty, "foo"), Throws.Nothing);
Assert.That (log.Messages.Count, Is.EqualTo (2), "An error was not logged");
Assert.That (log.Messages[1], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[1], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"PrivateSetter",
"Xamarin.Forms.Core.UnitTests.BindingUnitTests+DifferentViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
@ -1660,7 +1660,7 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.That (() => bindable.SetBinding (MockBindable.TextProperty, new Binding ("MissingProperty")), Throws.Nothing);
Assert.That (log.Messages.Count, Is.EqualTo (1), "An error was not logged");
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"MissingProperty",
"Xamarin.Forms.Core.UnitTests.MockViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",
@ -1688,7 +1688,7 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.That (() => bindable.SetBinding (MockBindable.TextProperty, new Binding ("Model.MissingProperty")), Throws.Nothing);
Assert.That (log.Messages.Count, Is.EqualTo (1), "An error was not logged");
Assert.That (log.Messages[0], Does.Contain(String.Format (BindingExpression.PropertyNotFoundErrorMessage,
Assert.That (log.Messages[0], Is.StringContaining (String.Format (BindingExpression.PropertyNotFoundErrorMessage,
"MissingProperty",
"Xamarin.Forms.Core.UnitTests.BindingBaseUnitTests+ComplexMockViewModel",
"Xamarin.Forms.Core.UnitTests.MockBindable",

Просмотреть файл

@ -1,6 +1,5 @@
using NUnit.Framework;
using System;
using System.Threading.Tasks;
namespace Xamarin.Forms.Core.UnitTests
{
@ -154,7 +153,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
public async Task ForceUpdateSizeCallsAreRateLimited()
public async void ForceUpdateSizeCallsAreRateLimited()
{
var lv = new ListView { HasUnevenRows = true };
var cell = new ViewCell { Parent = lv };
@ -173,7 +172,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
public async Task ForceUpdateSizeWillNotBeCalledIfParentIsNotAListViewWithUnevenRows ()
public async void ForceUpdateSizeWillNotBeCalledIfParentIsNotAListViewWithUnevenRows ()
{
var lv = new ListView { HasUnevenRows = false };
var cell = new ViewCell { Parent = lv };

Просмотреть файл

@ -11,7 +11,7 @@ namespace Xamarin.Forms.Core.UnitTests
public class GeocoderUnitTests : BaseTestFixture
{
[Test]
public async Task AddressesForPosition ()
public async void AddressesForPosition ()
{
Geocoder.GetAddressesForPositionFuncAsync = GetAddressesForPositionFuncAsync;
var geocoder = new Geocoder ();
@ -26,7 +26,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
public async Task PositionsForAddress () {
public async void PositionsForAddress () {
Geocoder.GetPositionsForAddressAsyncFunc = GetPositionsForAddressAsyncFunc ;
var geocoder = new Geocoder ();
var result = await geocoder.GetPositionsForAddressAsync ("quux");

Просмотреть файл

@ -61,14 +61,14 @@ namespace Xamarin.Forms.Core.UnitTests
[TestFixture]
public class MotionTests : BaseTestFixture
{
[OneTimeSetUp]
[TestFixtureSetUp]
public void Init ()
{
Device.PlatformServices = new MockPlatformServices ();
Ticker.Default = new BlockingTicker ();
}
[OneTimeTearDown]
[TestFixtureTearDown]
public void End ()
{
Device.PlatformServices = null;
@ -154,14 +154,14 @@ namespace Xamarin.Forms.Core.UnitTests
[TestFixture]
public class TickerSystemEnabledTests
{
[OneTimeSetUp]
[TestFixtureSetUp]
public void Init ()
{
Device.PlatformServices = new MockPlatformServices ();
Ticker.Default = new AsyncTicker();
}
[OneTimeTearDown]
[TestFixtureTearDown]
public void End ()
{
Device.PlatformServices = null;

Просмотреть файл

@ -441,7 +441,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
public async Task HandlesPopToRoot ()
public async void HandlesPopToRoot ()
{
var root = new ContentPage { Title = "Root" };
var navPage = new NavigationPage (root);
@ -489,7 +489,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
public async Task NavigatesBackWhenBackButtonPressed ()
public async void NavigatesBackWhenBackButtonPressed ()
{
var root = new ContentPage { Title = "Root" };
var navPage = new NavigationPage (root);
@ -503,7 +503,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
public async Task DoesNotNavigatesBackWhenBackButtonPressedIfHandled ()
public async void DoesNotNavigatesBackWhenBackButtonPressedIfHandled ()
{
var root = new BackButtonPage { Title = "Root" };
var second = new BackButtonPage () {Handle = true};
@ -562,7 +562,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
public async Task TestRemovePage()
public async void TestRemovePage()
{
var root = new ContentPage { Title = "Root" };
var newPage = new ContentPage();

Просмотреть файл

@ -261,7 +261,7 @@ namespace Xamarin.Forms.Core.UnitTests
var rd = new ResourceDictionary();
rd.Add("foo", "bar");
var ex = Assert.Throws<KeyNotFoundException>(() => { var foo = rd ["test_invalid_key"]; });
Assert.That(ex.Message, Does.Contain("test_invalid_key"));
Assert.That(ex.Message, Is.StringContaining("test_invalid_key"));
}
class MyRD : ResourceDictionary

Просмотреть файл

@ -411,7 +411,7 @@ namespace Xamarin.Forms.Core.UnitTests
[Test]
//https://bugzilla.xamarin.com/show_bug.cgi?id=31207
public async Task StyleDontHoldStrongReferences ()
public async void StyleDontHoldStrongReferences ()
{
var style = new Style (typeof(Label));
var label = new Label ();

Просмотреть файл

@ -1490,7 +1490,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
[Ignore("SpeedTestApply")]
[Ignore]
public void SpeedTestApply()
{
@ -1560,7 +1560,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
[Ignore("SpeedTestSetBC")]
[Ignore]
public void SpeedTestSetBC()
{
var property = BindableProperty.Create("Foo", typeof(string), typeof(MockBindable));

Просмотреть файл

@ -48,7 +48,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
[Ignore("LoadImageFromStream")]
[Ignore]
public void LoadImageFromStream ()
{
var loader = new UriImageSource {
@ -60,7 +60,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
[Ignore("SecondCallLoadFromCache")]
[Ignore]
public void SecondCallLoadFromCache ()
{
var loader = new UriImageSource {
@ -80,7 +80,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
[Ignore("DoNotKeepFailedRetrieveInCache")]
[Ignore]
public void DoNotKeepFailedRetrieveInCache ()
{
var loader = new UriImageSource {
@ -98,7 +98,7 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
[Ignore("ConcurrentCallsOnSameUriAreQueued")]
[Ignore]
public void ConcurrentCallsOnSameUriAreQueued ()
{
var loader = new UriImageSource {

Просмотреть файл

@ -45,10 +45,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter">
<Version>3.13.0</Version>
</PackageReference>
<PackageReference Include="NUnit" Version="2.6.4" />
<PackageReference Include="NUnitTestAdapter" Version="2.1.1" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
@ -245,8 +243,8 @@
</ItemGroup>
<Target Name="_CopyNUnitTestAdapterFiles" AfterTargets="Build">
<ItemGroup>
<_NUnitTestAdapterFiles Include="$(NuGetPackageRoot)NUnit3TestAdapter\%(Version)\build\net35\**" Condition="@(PackageReference -> '%(Identity)') == 'NUnit3TestAdapter'" InProject="False" />
<_NUnitTestAdapterFiles Include="$(NuGetPackageRoot)NUnitTestAdapter\%(Version)\**" Condition="@(PackageReference -> '%(Identity)') == 'NUnitTestAdapter'" InProject="False" />
</ItemGroup>
<Copy SourceFiles="@(_NUnitTestAdapterFiles)" DestinationFolder="$(SolutionDir)packages\NUnitTestAdapter.AnyVersion\tools\%(RecursiveDir)" ContinueOnError="true" Retries="0" />
<Copy SourceFiles="@(_NUnitTestAdapterFiles)" DestinationFolder="$(SolutionDir)packages\NUnitTestAdapter.AnyVersion\%(RecursiveDir)" ContinueOnError="true" Retries="0" />
</Target>
</Project>
</Project>

Просмотреть файл

@ -49,14 +49,14 @@
<PackageReference Include="Castle.Core" Version="4.3.1" />
<PackageReference Include="DotNetSeleniumExtras.PageObjects" Version="3.11.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit" Version="2.6.4" />
<PackageReference Include="NUnitTestAdapter">
<Version>2.1.1</Version>
</PackageReference>
<PackageReference Include="Selenium.Support" Version="3.14.0" />
<PackageReference Include="Selenium.WebDriver" Version="3.14.0" />
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.UITest" Version="3.0.0" />
<PackageReference Include="NUnit3TestAdapter">
<Version>3.13.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.UITest" Version="2.2.7" />
</ItemGroup>
<ItemGroup>
<Compile Include="WindowsTestBase.cs" />

Просмотреть файл

@ -46,9 +46,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit" Version="2.6.4" />
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.UITest" Version="3.0.0" />
<PackageReference Include="Xamarin.UITest" Version="2.2.7" />
</ItemGroup>
<ItemGroup>
<Compile Include="BaseViewContainerRemoteiOS.cs" />

Просмотреть файл

@ -48,12 +48,12 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit" Version="2.6.4" />
<PackageReference Include="ServiceStack.Client" Version="4.5.12" />
<PackageReference Include="ServiceStack.Interfaces" Version="4.5.12" />
<PackageReference Include="ServiceStack.Text" Version="4.5.12" />
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.UITest" Version="3.0.0" />
<PackageReference Include="Xamarin.UITest" Version="2.2.7" />
<PackageReference Include="Xamarin.UITest.Desktop" Version="0.0.7" />
</ItemGroup>
<ItemGroup>
@ -89,4 +89,4 @@
</ItemGroup>
<Copy SourceFiles="@(_XamarinUITestFiles)" DestinationFolder="$(SolutionDir)packages\Xamarin.UITest.AnyVersion\%(RecursiveDir)" ContinueOnError="true" Retries="0" />
</Target>
</Project>
</Project>

Просмотреть файл

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@ -42,10 +42,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter">
<Version>3.13.0</Version>
</PackageReference>
<PackageReference Include="NUnit" Version="2.6.4" />
<PackageReference Include="NUnitTestAdapter" Version="2.1.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Xamarin.Forms.Core.UnitTests\MockPlatformServices.cs">
@ -79,8 +77,8 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="_CopyNUnitTestAdapterFiles" AfterTargets="Build">
<ItemGroup>
<_NUnitTestAdapterFiles Include="$(NuGetPackageRoot)NUnit3TestAdapter\%(Version)\build\net35\**" Condition="@(PackageReference -&gt; '%(Identity)') == 'NUnit3TestAdapter'" InProject="False" />
<_NUnitTestAdapterFiles Include="$(NuGetPackageRoot)NUnitTestAdapter\%(Version)\**" Condition="@(PackageReference -> '%(Identity)') == 'NUnitTestAdapter'" InProject="False" />
</ItemGroup>
<Copy SourceFiles="@(_NUnitTestAdapterFiles)" DestinationFolder="$(SolutionDir)packages\NUnitTestAdapter.AnyVersion\tools\%(RecursiveDir)" ContinueOnError="true" Retries="0" />
<Copy SourceFiles="@(_NUnitTestAdapterFiles)" DestinationFolder="$(SolutionDir)packages\NUnitTestAdapter.AnyVersion\%(RecursiveDir)" ContinueOnError="true" Retries="0" />
</Target>
</Project>

Просмотреть файл

@ -167,7 +167,7 @@ namespace Xamarin.Forms.Xaml.UnitTests
Assert.That(page.Content.BackgroundColor, Is.EqualTo(Color.Red));
}
[Test][Ignore(nameof(ImplicitStyleAppliedToMissingType))]
[Test][Ignore]
public void ImplicitStyleAppliedToMissingType()
{
XamlLoader.FallbackTypeResolver = (p, type) => type ?? typeof(Button);
@ -224,7 +224,7 @@ namespace Xamarin.Forms.Xaml.UnitTests
Assert.That(myButton.BackgroundColor, Is.Not.EqualTo(Color.Red));
}
[Test][Ignore(nameof(StyleTargetingMissingTypeNotAppliedToFallbackType))]
[Test][Ignore]
public void StyleTargetingMissingTypeNotAppliedToFallbackType()
{
XamlLoader.FallbackTypeResolver = (p, type) => type ?? typeof(Button);

Просмотреть файл

@ -113,17 +113,16 @@ namespace Xamarin.Forms.Xaml.UnitTests
"Release";
#endif
var dir = Path.GetFullPath(
Path.Combine(
TestContext.CurrentContext.TestDirectory, "Xamarin.Forms.Controls.dll"));
var xamlg = new XamlGTask()
{
BuildEngine = new DummyBuildEngine(),
AssemblyName = "test",
Language = "C#",
XamlFiles = new[] { item },
OutputFiles = new[] { new TaskItem(xamlOutputFile) },
References = dir
OutputFiles = new [] { new TaskItem(xamlOutputFile) },
References = Path.GetFullPath(
Path.Combine(
Directory.GetCurrentDirectory(), "Xamarin.Forms.Controls.dll"))
};
var generator = new XamlGenerator(item, xamlg.Language, xamlg.AssemblyName, xamlOutputFile, xamlg.References, null);

Просмотреть файл

@ -795,12 +795,8 @@ namespace Xamarin.Forms.Xaml.UnitTests
var bindingType = XamlParser.GetElementType(new XmlType("http://xamarin.com/schemas/2014/forms", "Binding", null), null, null, out var ex);
Assert.That(ex, Is.Null);
Assert.That(bindingType, Is.EqualTo(typeof(BindingExtension)));
var module = ModuleDefinition.CreateModule("foo", new ModuleParameters()
{
AssemblyResolver = new MockAssemblyResolver(),
Kind = ModuleKind.Dll,
});
var bindingTypeRef = new XmlType("http://xamarin.com/schemas/2014/forms", "Binding", null).GetTypeReference(module, null);
var bindingTypeRef = new XmlType("http://xamarin.com/schemas/2014/forms", "Binding", null).GetTypeReference(ModuleDefinition.CreateModule("foo", ModuleKind.Dll), null);
Assert.That(bindingType.FullName, Is.EqualTo("Xamarin.Forms.Xaml.BindingExtension"));
}
}

Просмотреть файл

@ -488,15 +488,15 @@ namespace Xamarin.Forms.MSBuild.UnitTests
AssertExists (Path.Combine (intermediateDirectory, "XamlC.stamp"));
}
[Test]
public void InvalidXml([Values(false, true)] bool sdkStyle)
[Test, ExpectedException (typeof(AssertionException))]
public void InvalidXml ([Values (false, true)] bool sdkStyle)
{
var project = NewProject(sdkStyle);
project.Add(AddFile("MainPage.xaml", "EmbeddedResource", "notxmlatall"));
var projectFile = Path.Combine(tempDirectory, "test.csproj");
project.Save(projectFile);
RestoreIfNeeded(projectFile, sdkStyle);
Assert.Throws<AssertionException>(() => Build(projectFile));
var project = NewProject (sdkStyle);
project.Add (AddFile ("MainPage.xaml", "EmbeddedResource", "notxmlatall"));
var projectFile = Path.Combine (tempDirectory, "test.csproj");
project.Save (projectFile);
RestoreIfNeeded (projectFile, sdkStyle);
Build (projectFile);
}
[Test]

Просмотреть файл

@ -1,20 +0,0 @@
using Mono.Cecil;
using NUnit.Framework;
using System.IO;
namespace Xamarin.Forms.Xaml.UnitTests
{
public class MockAssemblyResolver : BaseAssemblyResolver
{
public override AssemblyDefinition Resolve(AssemblyNameReference name)
{
AssemblyDefinition assembly;
var localPath = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, $"{name.Name}.dll"));
if (File.Exists(localPath))
assembly = AssemblyDefinition.ReadAssembly(localPath);
else
assembly = base.Resolve(name);
return assembly;
}
}
}

Просмотреть файл

@ -46,7 +46,7 @@ namespace Xamarin.Forms.Xaml.UnitTests
}
[Test]
[Ignore(nameof(XamlCIs20TimesFasterThanXaml))]
[Ignore]
public void XamlCIs20TimesFasterThanXaml ()
{
var swXamlC = new Stopwatch ();
@ -66,7 +66,7 @@ namespace Xamarin.Forms.Xaml.UnitTests
}
[Test]
[Ignore(nameof(XamlCIsNotMuchSlowerThanCode))]
[Ignore]
public void XamlCIsNotMuchSlowerThanCode ()
{
var swXamlC = new Stopwatch ();

Просмотреть файл

@ -4,7 +4,7 @@
<RootNamespace>Xamarin.Forms.Xaml.UnitTests</RootNamespace>
<AssemblyName>Xamarin.Forms.Xaml.UnitTests</AssemblyName>
<WarningLevel>4</WarningLevel>
<NoWarn>0672;0219;0414;CS0436</NoWarn>
<NoWarn>0672;0219;0414</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
@ -19,9 +19,8 @@
<ProjectReference Include="..\Xamarin.Forms.Build.Tasks\Xamarin.Forms.Build.Tasks.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="NUnit" Version="2.6.4" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.0.31" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Xamarin.Forms.Core.UnitTests\MockPlatformServices.cs">

Просмотреть файл

@ -6,7 +6,6 @@ using Mono.Cecil;
using Xamarin.Forms.Build.Tasks;
using NUnit.Framework;
using Xamarin.Forms.Xaml.UnitTests;
namespace Xamarin.Forms.XamlcUnitTests
{
@ -32,11 +31,7 @@ namespace Xamarin.Forms.XamlcUnitTests
[SetUp]
public void SetUp ()
{
module = ModuleDefinition.CreateModule("foo", new ModuleParameters()
{
AssemblyResolver = new MockAssemblyResolver(),
Kind = ModuleKind.Dll,
});
module = ModuleDefinition.CreateModule ("foo", ModuleKind.Dll);
}
[Test]

Просмотреть файл

@ -7,7 +7,6 @@ using Xamarin.Forms.Build.Tasks;
using NUnit.Framework;
using System.Collections.Generic;
using Xamarin.Forms.Xaml.UnitTests;
namespace Xamarin.Forms.XamlcUnitTests
{
@ -34,11 +33,7 @@ namespace Xamarin.Forms.XamlcUnitTests
[SetUp]
public void SetUp()
{
module = ModuleDefinition.CreateModule("foo", new ModuleParameters()
{
AssemblyResolver = new MockAssemblyResolver(),
Kind = ModuleKind.Dll,
});
module = ModuleDefinition.CreateModule("foo", ModuleKind.Dll);
}
[Test]

Просмотреть файл

@ -1,3 +1,4 @@
using System;
using System.Linq;
using Mono.Cecil;
@ -6,7 +7,6 @@ using Xamarin.Forms.Build.Tasks;
using NUnit.Framework;
using System.Collections.Generic;
using Xamarin.Forms.Xaml.UnitTests;
namespace Xamarin.Forms.XamlcUnitTests
{
@ -23,13 +23,9 @@ namespace Xamarin.Forms.XamlcUnitTests
}
[SetUp]
public void SetUp()
public void SetUp ()
{
module = ModuleDefinition.CreateModule("foo", new ModuleParameters()
{
AssemblyResolver = new MockAssemblyResolver(),
Kind = ModuleKind.Dll,
});
module = ModuleDefinition.CreateModule ("foo", ModuleKind.Dll);
}
[Test]

Просмотреть файл

@ -2,7 +2,7 @@ using System;
using NUnit.Framework.Constraints;
namespace Xamarin.Forms.Xaml.UnitTests
{
{
public class XamlParseExceptionConstraint : ExceptionTypeConstraint
{
bool haslineinfo;
@ -10,14 +10,13 @@ namespace Xamarin.Forms.Xaml.UnitTests
int lineposition;
Func<string, bool> messagePredicate;
XamlParseExceptionConstraint(bool haslineinfo) : base(typeof(XamlParseException))
XamlParseExceptionConstraint (bool haslineinfo) : base (typeof (XamlParseException))
{
this.haslineinfo = haslineinfo;
DisplayName = "xamlparse";
}
public override string DisplayName => "xamlparse";
public XamlParseExceptionConstraint() : this(false)
public XamlParseExceptionConstraint () : this (false)
{
}
@ -28,8 +27,9 @@ namespace Xamarin.Forms.Xaml.UnitTests
this.messagePredicate = messagePredicate;
}
protected override bool Matches (object actual)
public override bool Matches (object actual)
{
this.actual = actual;
if (!base.Matches (actual))
return false;
var xmlInfo = ((XamlParseException)actual).XmlInfo;
@ -43,30 +43,25 @@ namespace Xamarin.Forms.Xaml.UnitTests
return xmlInfo.LineNumber == linenumber && xmlInfo.LinePosition == lineposition;
}
public override string Description
public override void WriteDescriptionTo (MessageWriter writer)
{
get
{
if (haslineinfo)
{
return string.Format($"{base.Description} line {linenumber}, position {lineposition}");
}
return base.Description;
}
base.WriteDescriptionTo (writer);
if (haslineinfo)
writer.Write (string.Format (" line {0}, position {1}", linenumber, lineposition));
}
//public override void WriteActualValueTo (MessageWriter writer)
//{
// var ex = actual as XamlParseException;
// writer.WriteActualValue ((actual == null) ? null : actual.GetType ());
// if (ex != null) {
// if (ex.XmlInfo != null && ex.XmlInfo.HasLineInfo ())
// writer.Write (" line {0}, position {1}", ex.XmlInfo.LineNumber, ex.XmlInfo.LinePosition);
// else
// writer.Write (" no line info");
// writer.WriteLine (" ({0})", ex.Message);
// writer.Write (ex.StackTrace);
// }
//}
public override void WriteActualValueTo (MessageWriter writer)
{
var ex = actual as XamlParseException;
writer.WriteActualValue ((actual == null) ? null : actual.GetType ());
if (ex != null) {
if (ex.XmlInfo != null && ex.XmlInfo.HasLineInfo ())
writer.Write (" line {0}, position {1}", ex.XmlInfo.LineNumber, ex.XmlInfo.LinePosition);
else
writer.Write (" no line info");
writer.WriteLine (" ({0})", ex.Message);
writer.Write (ex.StackTrace);
}
}
}
}