Skip to content

Commit 20a34f2

Browse files
Refactor service provider usage and clean up context
Updated `InitializeServicesAndSetMockApplication` to use `serviceProvider` for setting the Maui context. Removed unnecessary `using` directive and `AnimationManager` property from `HandlersContextStub`, indicating a refactor of animation management functionality.
1 parent bd69db1 commit 20a34f2

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/CommunityToolkit.Maui.UnitTests/BaseHandlerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static void InitializeServicesAndSetMockApplication(out IServiceProvider service
7272
IPlatformApplication.Current = application;
7373

7474
application.Handler = new ApplicationHandlerStub();
75-
application.Handler.SetMauiContext(new HandlersContextStub(mauiApp.Services));
75+
application.Handler.SetMauiContext(new HandlersContextStub(serviceProvider));
7676

7777
CreateElementHandler<MockPopupHandler>(mockPopup);
7878
CreateViewHandler<MockPageHandler>(page);
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
using Microsoft.Maui.Animations;
2-
3-
namespace CommunityToolkit.Maui.UnitTests.Mocks;
1+
namespace CommunityToolkit.Maui.UnitTests.Mocks;
42

53
class HandlersContextStub : IMauiContext
64
{
75
public HandlersContextStub(IServiceProvider services)
86
{
97
Services = services;
108
Handlers = Services.GetRequiredService<IMauiHandlersFactory>();
11-
AnimationManager = services.GetService<IAnimationManager>() ?? throw new NullReferenceException();
129
}
1310

1411
public IServiceProvider Services { get; }
1512

1613
public IMauiHandlersFactory Handlers { get; }
17-
18-
public IAnimationManager AnimationManager { get; }
1914
}

0 commit comments

Comments
 (0)