-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from chickensoft-games/fix/addons-errors
fix: better addons installation error reporting
- Loading branch information
Showing
8 changed files
with
77 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 7 additions & 16 deletions
23
...tEnv.Tests/src/features/addons/commands/install/AddonsLogic.State.CannotBeResolvedTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,19 @@ | ||
namespace Chickensoft.GodotEnv.Tests; | ||
|
||
using Chickensoft.GodotEnv.Common.Utilities; | ||
using System.Linq; | ||
using Chickensoft.GodotEnv.Features.Addons.Commands; | ||
using Moq; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
public class CannotBeResolvedTest { | ||
[Fact] | ||
public void ReportsOnEnter() { | ||
var context = new Mock<AddonsLogic.IContext>(); | ||
var log = new Mock<ILog>(); | ||
var state = new AddonsLogic.State.CannotBeResolved(); | ||
var context = state.CreateFakeContext(); | ||
|
||
log.Setup(log => log.Err(It.IsAny<string>())); | ||
context | ||
.Setup(ctx => ctx.Output(It.IsAny<AddonsLogic.Output.Report>())) | ||
.Callback<AddonsLogic.Output>( | ||
output => ((AddonsLogic.Output.Report)output).Event.Report(log.Object) | ||
); | ||
state.Enter(); | ||
|
||
var state = new AddonsLogic.State.CannotBeResolved(context.Object); | ||
var stateTester = AddonsLogic.Test(state); | ||
|
||
stateTester.Enter(); | ||
|
||
context.VerifyAll(); | ||
var output = | ||
context.Outputs.Single().ShouldBeOfType<AddonsLogic.Output.Report>(); | ||
} | ||
} |
22 changes: 6 additions & 16 deletions
22
...Tests/src/features/addons/commands/install/AddonsLogic.State.InstallationSucceededTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,18 @@ | ||
namespace Chickensoft.GodotEnv.Tests; | ||
|
||
using Chickensoft.GodotEnv.Common.Utilities; | ||
using System.Linq; | ||
using Chickensoft.GodotEnv.Features.Addons.Commands; | ||
using Moq; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
public class InstallationSucceededTest { | ||
[Fact] | ||
public void ReportsOnEnter() { | ||
var context = new Mock<AddonsLogic.IContext>(); | ||
var log = new Mock<ILog>(); | ||
var state = new AddonsLogic.State.InstallationSucceeded(); | ||
var context = state.CreateFakeContext(); | ||
|
||
log.Setup(log => log.Err(It.IsAny<string>())); | ||
context | ||
.Setup(ctx => ctx.Output(It.IsAny<AddonsLogic.Output.Report>())) | ||
.Callback<AddonsLogic.Output>( | ||
output => ((AddonsLogic.Output.Report)output).Event.Report(log.Object) | ||
); | ||
state.Enter(); | ||
|
||
var state = new AddonsLogic.State.InstallationSucceeded(context.Object); | ||
var stateTester = AddonsLogic.Test(state); | ||
|
||
stateTester.Enter(); | ||
|
||
context.VerifyAll(); | ||
context.Outputs.Single().ShouldBeOfType<AddonsLogic.Output.Report>(); | ||
} | ||
} |
22 changes: 6 additions & 16 deletions
22
...tEnv.Tests/src/features/addons/commands/install/AddonsLogic.State.NothingToInstallTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,18 @@ | ||
namespace Chickensoft.GodotEnv.Tests; | ||
|
||
using Chickensoft.GodotEnv.Common.Utilities; | ||
using System.Linq; | ||
using Chickensoft.GodotEnv.Features.Addons.Commands; | ||
using Moq; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
public class NothingToInstallTest { | ||
[Fact] | ||
public void ReportsOnEnter() { | ||
var context = new Mock<AddonsLogic.IContext>(); | ||
var log = new Mock<ILog>(); | ||
var state = new AddonsLogic.State.NothingToInstall(); | ||
var context = state.CreateFakeContext(); | ||
|
||
log.Setup(log => log.Err(It.IsAny<string>())); | ||
context | ||
.Setup(ctx => ctx.Output(It.IsAny<AddonsLogic.Output.Report>())) | ||
.Callback<AddonsLogic.Output>( | ||
output => ((AddonsLogic.Output.Report)output).Event.Report(log.Object) | ||
); | ||
state.Enter(); | ||
|
||
var state = new AddonsLogic.State.NothingToInstall(context.Object); | ||
var stateTester = AddonsLogic.Test(state); | ||
|
||
stateTester.Enter(); | ||
|
||
context.VerifyAll(); | ||
context.Outputs.Single().ShouldBeOfType<AddonsLogic.Output.Report>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.