Fix DI type

This commit is contained in:
ansel 2022-09-28 18:26:36 +03:00
parent 7645fe20f5
commit 85adfc2df7
5 changed files with 41 additions and 38 deletions

View File

@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual.Online
{
private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
[Cached]
[Cached(typeof(IDialogOverlay))]
private readonly DialogOverlay dialogOverlay = new DialogOverlay();
[Cached]
@ -137,49 +137,52 @@ namespace osu.Game.Tests.Visual.Online
private void addTestComments()
{
CommentBundle cb = new CommentBundle
AddStep("set up response", () =>
{
Comments = new List<Comment>
CommentBundle cb = new CommentBundle
{
new Comment
Comments = new List<Comment>
{
Id = 1,
Message = "This is our comment",
UserId = API.LocalUser.Value.Id,
CreatedAt = DateTimeOffset.Now,
User = API.LocalUser.Value,
},
new Comment
{
Id = 2,
Message = "This is a comment by another user",
UserId = API.LocalUser.Value.Id + 1,
CreatedAt = DateTimeOffset.Now,
User = new APIUser
new Comment
{
Id = API.LocalUser.Value.Id + 1,
Username = "Another user"
}
Id = 1,
Message = "This is our comment",
UserId = API.LocalUser.Value.Id,
CreatedAt = DateTimeOffset.Now,
User = API.LocalUser.Value,
},
new Comment
{
Id = 2,
Message = "This is a comment by another user",
UserId = API.LocalUser.Value.Id + 1,
CreatedAt = DateTimeOffset.Now,
User = new APIUser
{
Id = API.LocalUser.Value.Id + 1,
Username = "Another user"
}
},
},
},
IncludedComments = new List<Comment>(),
PinnedComments = new List<Comment>(),
};
setUpCommentsResponse(cb);
IncludedComments = new List<Comment>(),
PinnedComments = new List<Comment>(),
};
setUpCommentsResponse(cb);
});
AddStep("show comments", () => commentsContainer.ShowComments(CommentableType.Beatmapset, 123));
}
private void setUpCommentsResponse(CommentBundle commentBundle)
=> AddStep("set up response", () =>
{
dummyAPI.HandleRequest = request =>
{
dummyAPI.HandleRequest = request =>
{
if (!(request is GetCommentsRequest getCommentsRequest))
return false;
if (!(request is GetCommentsRequest getCommentsRequest))
return false;
getCommentsRequest.TriggerSuccess(commentBundle);
return true;
};
});
getCommentsRequest.TriggerSuccess(commentBundle);
return true;
};
}
}
}

View File

@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Online
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
[Cached]
[Cached(typeof(IDialogOverlay))]
private readonly DialogOverlay dialogOverlay = new DialogOverlay();
private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;

View File

@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual.Online
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
[Cached]
[Cached(typeof(IDialogOverlay))]
private readonly DialogOverlay dialogOverlay = new DialogOverlay();
private Container container;

View File

@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Online
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
[Cached]
[Cached(typeof(IDialogOverlay))]
private readonly DialogOverlay dialogOverlay = new DialogOverlay();
private TestCommentsContainer comments;

View File

@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Comments
private DeletedCommentsCounter deletedCommentsCounter;
[Resolved]
private DialogOverlay dialogOverlay { get; set; }
private IDialogOverlay dialogOverlay { get; set; }
[Resolved]
private IAPIProvider api { get; set; }