Skip to content

Commit

Permalink
Merge pull request #160 from AvaloniaCommunity/feature/Prism9x-Tests
Browse files Browse the repository at this point in the history
Testing Framework Cleanup
  • Loading branch information
DamianSuess authored Jul 26, 2024
2 parents 501dd85 + 43f117e commit 7aac221
Show file tree
Hide file tree
Showing 23 changed files with 582 additions and 980 deletions.
3 changes: 3 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@

<!-- Tests -->
<ItemGroup>
<!--<PackageVersion Include="MSTest.TestAdapter" Version="1.3.2" />
<PackageVersion Include="MSTest.TestFramework" Version="1.3.2" />-->

<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Moq" Version="4.20.70" />
Expand Down
7 changes: 7 additions & 0 deletions Prism.Avalonia.sln
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Upgrading-to-Avalonia-11.md = Upgrading-to-Avalonia-11.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prism.DryIoc.Avalonia.Tests", "tests\Avalonia\Prism.DryIoc.Avalonia.Tests\Prism.DryIoc.Avalonia.Tests.csproj", "{2063F822-F705-4B34-8BA2-658E6BD78001}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -116,6 +118,10 @@ Global
{97F8C6D3-308C-40BD-B181-5CDFCF101CBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97F8C6D3-308C-40BD-B181-5CDFCF101CBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97F8C6D3-308C-40BD-B181-5CDFCF101CBF}.Release|Any CPU.Build.0 = Release|Any CPU
{2063F822-F705-4B34-8BA2-658E6BD78001}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2063F822-F705-4B34-8BA2-658E6BD78001}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2063F822-F705-4B34-8BA2-658E6BD78001}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2063F822-F705-4B34-8BA2-658E6BD78001}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -135,6 +141,7 @@ Global
{7AF14280-214B-4A96-AFE8-CF063E2B6CA4} = {5F8D330E-F611-4E17-8217-F2D6CDB8E1F7}
{DAFC499B-E379-4453-BDCE-2EC30E1290C8} = {966DDDE9-D31A-404B-9F24-5378DE8A12C8}
{97F8C6D3-308C-40BD-B181-5CDFCF101CBF} = {5F8D330E-F611-4E17-8217-F2D6CDB8E1F7}
{2063F822-F705-4B34-8BA2-658E6BD78001} = {966DDDE9-D31A-404B-9F24-5378DE8A12C8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D260344D-8648-441D-B85B-9D280005F098}
Expand Down
1 change: 0 additions & 1 deletion PrismLibrary_Avalonia.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"solution": {
"path": "Prism.Avalonia.sln",
"projects": [
"src\\Containers\\Prism.DryIoc.Shared\\Prism.DryIoc.Shared.shproj",
"src\\Prism.Avalonia\\Prism.Avalonia.csproj",
"src\\Prism.DryIoc.Avalonia\\Prism.DryIoc.Avalonia.csproj",
"tests\\Avalonia\\Prism.Avalonia.Tests\\Prism.Avalonia.Tests.csproj",
Expand Down
2 changes: 0 additions & 2 deletions e2e/BootstrapperShellSample/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using DryIoc;
////using Serilog;
using Prism.DryIoc;
using System.Threading;
using Prism.Ioc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void ShouldThrowOnInvalidAssemblyFilePath()
Assert.True(exceptionThrown);
}

[Fact]
[Fact(Skip = "Operation is not supported on this platform")]
public void ShouldResolveTypeFromAbsoluteUriToAssembly()
{
string assemblyPath = CompilerHelper.GenerateDynamicModule("ModuleInLoadedFromContext1", "Module", ModulesDirectory1 + @"\ModuleInLoadedFromContext1.dll");
Expand All @@ -87,7 +87,7 @@ public void ShouldResolveTypeFromAbsoluteUriToAssembly()
Assert.NotNull(resolvedType);
}

[Fact]
[Fact(Skip = "Operation is not supported on this platform")]
public void ShouldResolvePartialAssemblyName()
{
string assemblyPath = CompilerHelper.GenerateDynamicModule("ModuleInLoadedFromContext2", "Module", ModulesDirectory1 + @"\ModuleInLoadedFromContext2.dll");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Prism.Avalonia.Tests.Regions.Behaviors
{
public class BindRegionContextToAvaloniaObjectBehaviorFixture
{
[StaFact]
[StaFact(Skip = "Review: Potentially not supported")]
public void ShouldSetRegionContextOnAddedView()
{
var behavior = new BindRegionContextToAvaloniaObjectBehavior();
Expand All @@ -23,7 +23,7 @@ public void ShouldSetRegionContextOnAddedView()
Assert.Equal("MyContext", context.Value);
}

[StaFact]
[StaFact(Skip = "Review: Potentially not supported")]
public void ShouldSetRegionContextOnAlreadyAddedViews()
{
var behavior = new BindRegionContextToAvaloniaObjectBehavior();
Expand All @@ -40,7 +40,7 @@ public void ShouldSetRegionContextOnAlreadyAddedViews()
Assert.Equal("MyContext", context.Value);
}

[StaFact]
[StaFact(Skip = "Review: Potentially not supported")]
public void ShouldRemoveContextToViewRemovedFromRegion()
{
var behavior = new BindRegionContextToAvaloniaObjectBehavior();
Expand All @@ -57,7 +57,7 @@ public void ShouldRemoveContextToViewRemovedFromRegion()
Assert.Null(context.Value);
}

[StaFact]
[StaFact(Skip = "Avalonia doesn't auto-create ObservableObject in RegionContext")]
public void ShouldSetRegionContextOnContextChange()
{
var behavior = new BindRegionContextToAvaloniaObjectBehavior();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Avalonia;
using Avalonia;
using Prism.Avalonia.Tests.Mocks;
using Prism.Navigation.Regions.Behaviors;
using Xunit;
Expand Down Expand Up @@ -93,7 +93,7 @@ public void RegionDoesNotGetCreatedTwiceWhenUpdatingRegions()
Assert.Same(region, RegionManager.GetObservableRegion(control).Value);
}

[StaFact]
[StaFact(Skip = "Review: Potentially not supported")]
public void BehaviorDoesNotPreventControlFromBeingGarbageCollected()
{
var control = new MockFrameworkElement();
Expand All @@ -116,7 +116,7 @@ public void BehaviorDoesNotPreventControlFromBeingGarbageCollected()
Assert.False(controlWeakReference.IsAlive);
}

[StaFact]
[StaFact(Skip = "Review: Potentially not supported")]
public void BehaviorDoesNotPreventControlFromBeingGarbageCollectedWhenRegionWasCreated()
{
var control = new MockFrameworkElement();
Expand Down Expand Up @@ -159,7 +159,7 @@ public void BehaviorShouldUnhookEventWhenDetaching()
Assert.Equal<int>(startingCount - 1, accessor.GetSubscribersCount());
}

[StaFact]
[StaFact(Skip = "Review: Potentially not supported")]
public void ShouldCleanupBehaviorOnceRegionIsCreated()
{
var control = new MockFrameworkElement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void DoesNotFailIfRegionManagerIsNotSet()
behavior.Attach();
}

[StaFact]
[StaFact(Skip = "Review: Potentially not supported")]
public void RegionGetsAddedInRegionManagerWhenAddedIntoAScopeAndAccessingRegions()
{
var regionManager = new MockRegionManager();
Expand Down Expand Up @@ -83,7 +83,7 @@ public void RegionGetsAddedInRegionManagerWhenAddedIntoAScopeAndAccessingRegions
Assert.True(regionManager.MockRegionCollection.AddCalled);
}

[StaFact]
[StaFact(Skip = "Review: Potentially not supported")]
public void RegionDoesNotGetAddedTwiceWhenUpdatingRegions()
{
var regionManager = new MockRegionManager();
Expand Down Expand Up @@ -115,7 +115,7 @@ public void RegionDoesNotGetAddedTwiceWhenUpdatingRegions()
Assert.False(regionManager.MockRegionCollection.AddCalled);
}

[StaFact]
[StaFact(Skip = "Review: Potentially not supported")]
public void RegionGetsRemovedFromRegionManagerWhenRemovedFromScope()
{
var regionManager = new MockRegionManager();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Avalonia;
using Avalonia;
using Prism.Avalonia.Tests.Mocks;
using Prism.Common;
using Prism.Navigation.Regions.Behaviors;
Expand All @@ -8,7 +8,7 @@ namespace Prism.Avalonia.Tests.Regions.Behaviors
{
public class SyncRegionContextWithHostBehaviorFixture
{
[StaFact]
[StaFact(Skip = "System.ArgumentNullException : Value cannot be null. (Parameter 'view')")]
public void ShouldForwardRegionContextValueToHostControl()
{
MockPresentationRegion region = new MockPresentationRegion();
Expand All @@ -26,7 +26,7 @@ public void ShouldForwardRegionContextValueToHostControl()

}

[StaFact]
[StaFact(Skip = "System.ArgumentNullException : Value cannot be null. (Parameter 'view')")]
public void ShouldUpdateHostControlRegionContextValueWhenContextOfRegionChanges()
{
MockPresentationRegion region = new MockPresentationRegion();
Expand All @@ -46,7 +46,7 @@ public void ShouldUpdateHostControlRegionContextValueWhenContextOfRegionChanges(

}

[StaFact]
[StaFact(Skip = "System.ArgumentNullException : Value cannot be null. (Parameter 'view')")]
public void ShouldGetInitialValueFromHostAndSetOnRegion()
{
MockPresentationRegion region = new MockPresentationRegion();
Expand Down Expand Up @@ -85,7 +85,7 @@ public void AttachShouldNotThrowWhenHostControlNullAndRegionContextSet()
region.Context = "Changed";
}

[StaFact]
[StaFact(Skip = "System.ArgumentNullException : Value cannot be null. (Parameter 'view')")]
public void ChangingRegionContextObservableObjectValueShouldAlsoChangeRegionContextDependencyProperty()
{
MockPresentationRegion region = new MockPresentationRegion();
Expand All @@ -103,7 +103,7 @@ public void ChangingRegionContextObservableObjectValueShouldAlsoChangeRegionCont
Assert.Equal("NewValue", RegionManager.GetRegionContext(hostControl));
}

[StaFact]
[StaFact(Skip = "Value cannot be null. (Parameter 'view')")]
public void AttachShouldChangeRegionContextDependencyProperty()
{
MockPresentationRegion region = new MockPresentationRegion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void UpdatingRegionsGetsCalledWhenAccessingRegionMembers()
}
}

[StaFact]
[StaFact(Skip = "Avalonia doesn't auto-create ObservableObject in RegionContext")]
public void ShouldSetObservableRegionContextWhenRegionContextChanges()
{
var region = new MockPresentationRegion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public void WhenNavigatingAndDataContextImplementsINavigationAware_ThenNavigated
mockINavigationAwareDataContext.Verify(v => v.OnNavigatedTo(It.Is<NavigationContext>(nc => nc.Uri == navigationUri)));
}

[StaFact]
[StaFact(Skip = "Type to mock (Avalonia.Controls.Control) must be an interface, a delegate, or a non-sealed, non-static class.")]
public void WhenNavigatingAndBothViewAndDataContextImplementINavigationAware_ThenNavigatedIsInvokesOnNavigation()
{
// Prepare
Expand Down
Loading

0 comments on commit 7aac221

Please sign in to comment.