Skip to content

Commit

Permalink
Unit Tests - Notes
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianSuess committed Jul 14, 2022
1 parent b69ab50 commit d8a0a28
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/Prism.Avalonia/Mvvm/ViewModelLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
using Avalonia;
using Avalonia.Controls;

#if NETFX_CORE
using Windows.UI.Xaml;
#endif
namespace Prism.Mvvm
{
/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions src/Prism.Avalonia/PrismInitializationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ internal static void RegisterRequiredTypes(this IContainerRegistry containerRegi

internal static void RegisterDefaultRegionBehaviors(this IRegionBehaviorFactory regionBehaviors)
{
//// WPF: regionBehaviors.AddIfMissing<BindRegionContextToDependencyObjectBehavior>(BindRegionContextToDependencyObjectBehavior.BehaviorKey);
//// Avalonia Equivilant: BindRegionContextToAvaloniaObjectBehavior
//// Avalonia to WPF Equivilant: BindRegionContextToAvaloniaObjectBehavior == BindRegionContextToDependencyObjectBehavior
regionBehaviors.AddIfMissing<BindRegionContextToAvaloniaObjectBehavior>(BindRegionContextToAvaloniaObjectBehavior.BehaviorKey);
regionBehaviors.AddIfMissing<RegionActiveAwareBehavior>(RegionActiveAwareBehavior.BehaviorKey);
regionBehaviors.AddIfMissing<SyncRegionContextWithHostBehavior>(SyncRegionContextWithHostBehavior.BehaviorKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Prism.Avalonia.Tests.Mocks;
using Xunit;

namespace Prism.Avalonia.Tests.Logging
namespace Prism.Avalonia.Tests.Interactivity
{
// Override Prism.Interactivity.InvokeCommandAction until it can be implemented.
//// Reference:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Prism.Avalonia.Tests.Mocks
{
/// <summary>MockAvaloniaObject.</summary>
public class MockDependencyObject : AvaloniaObject
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ViewModelLocatorFixture
[StaFact]
public void ShouldLocateViewModelWithDefaultSettings()
{
// Warning: flaky test. This runs by itself but not as a whole.
ResetViewModelLocationProvider();

Mock view = new Mock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ public void RequiredTypesAreRegistered()
{
application.MockContainer.Verify(x => x.RegisterInstance(typeof(IModuleCatalog), It.IsAny<IModuleCatalog>()), Times.Once);

application.MockContainer.Verify(x => x.RegisterSingleton(typeof(IDialogService), typeof(DialogService)), Times.Once);
// TODO: IDialogService is not implemented
//// application.MockContainer.Verify(x => x.RegisterSingleton(typeof(IDialogService), typeof(DialogService)), Times.Once);
application.MockContainer.Verify(x => x.RegisterSingleton(typeof(IModuleInitializer), typeof(ModuleInitializer)), Times.Once);
application.MockContainer.Verify(x => x.RegisterSingleton(typeof(IModuleManager), typeof(ModuleManager)), Times.Once);
application.MockContainer.Verify(x => x.RegisterSingleton(typeof(RegionAdapterMappings), typeof(RegionAdapterMappings)), Times.Once);
Expand All @@ -216,7 +217,8 @@ public void RequiredTypesAreRegistered()
application.MockContainer.Verify(x => x.Register(typeof(IRegionNavigationJournalEntry), typeof(RegionNavigationJournalEntry)), Times.Once);
application.MockContainer.Verify(x => x.Register(typeof(IRegionNavigationJournal), typeof(RegionNavigationJournal)), Times.Once);
application.MockContainer.Verify(x => x.Register(typeof(IRegionNavigationService), typeof(RegionNavigationService)), Times.Once);
application.MockContainer.Verify(x => x.Register(typeof(IDialogWindow), typeof(DialogWindow)), Times.Once);
// TODO: IDialogService is not implemented
//// application.MockContainer.Verify(x => x.Register(typeof(IDialogWindow), typeof(DialogWindow)), Times.Once);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public void ShouldSetObservableRegionContextWhenRegionContextChanges()
var region = new MockPresentationRegion();
var view = new MockDependencyObject();

// NOTE: AvaloniaObject performs `Dispatcher.UIThread.VerifyAccess()`, if it's FALSE the InheritanceParent returns NULL.
var observableObject = RegionContext.GetObservableContext(view);

bool propertyChangedCalled = false;
Expand Down

0 comments on commit d8a0a28

Please sign in to comment.