Skip to content

Commit

Permalink
test: updates tests that need fixing and upgrades to autoinject 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jolexxa committed Jul 6, 2024
1 parent c60c29c commit e94ab40
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion GameDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<PackageReference Include="EnvironmentAbstractions" Version="3.0.2" />
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.1.1" PrivateAssets="all" OutputItemType="analyzer" />
<PackageReference Include="Chickensoft.SaveFileBuilder" Version="1.1.0" />
<PackageReference Include="Chickensoft.AutoInject" Version="2.0.0" PrivateAssets="all" />
<PackageReference Include="Chickensoft.AutoInject" Version="2.1.0" PrivateAssets="all" />
<PackageReference Include="Chickensoft.Collections" Version="1.7.0" />
<PackageReference Include="Chickensoft.GodotNodeInterfaces" Version="2.2.0" />
<PackageReference Include="Chickensoft.Introspection" Version="1.3.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/app/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public partial class App : CanvasLayer, IApp {

#endregion Nodes

public void Setup() {
public void Initialize() {
Instantiator = new Instantiator(GetTree());
AppRepo = new AppRepo();
AppLogic = new AppLogic();
Expand Down
2 changes: 1 addition & 1 deletion src/game/domain/GameRepo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace GameDemo;

using System;
using Chickensoft.GoDotCollections;
using Chickensoft.Collections;
using Godot;

public interface IGameRepo : IDisposable {
Expand Down
2 changes: 1 addition & 1 deletion test/src/app/AppTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void Initializes() {

_app.AppBinding = _binding;

_app.Setup();
_app.Initialize();

_app.Instantiator.ShouldBeOfType<Instantiator>();
_app.AppRepo.ShouldBeOfType<AppRepo>();
Expand Down
2 changes: 1 addition & 1 deletion test/src/game/domain/GameRepoTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace GameDemo.Tests;

using Chickensoft.GoDotCollections;
using Chickensoft.Collections;
using Chickensoft.GoDotTest;
using Godot;
using Moq;
Expand Down
2 changes: 1 addition & 1 deletion test/src/game/state/GameLogic.StateTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace GameDemo.Tests;

using Chickensoft.GoDotCollections;
using Chickensoft.Collections;
using Chickensoft.GoDotTest;
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
Expand Down
2 changes: 1 addition & 1 deletion test/src/game/state/states/MenuBackdropTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace GameDemo.Tests;

using System.Linq;
using Chickensoft.GoDotCollections;
using Chickensoft.Collections;
using Chickensoft.GoDotTest;
using Chickensoft.LogicBlocks;
using Godot;
Expand Down
2 changes: 1 addition & 1 deletion test/src/game/state/states/PlayingTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace GameDemo.Tests;

using System.Linq;
using Chickensoft.GoDotCollections;
using Chickensoft.Collections;
using Chickensoft.GoDotTest;
using Chickensoft.LogicBlocks;
using Godot;
Expand Down
2 changes: 1 addition & 1 deletion test/src/in_game_ui/InGameUITest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace GameDemo.Tests;

using Chickensoft.AutoInject;
using Chickensoft.GoDotCollections;
using Chickensoft.Collections;
using Chickensoft.GodotNodeInterfaces;
using Chickensoft.GoDotTest;
using Godot;
Expand Down
2 changes: 1 addition & 1 deletion test/src/in_game_ui/state/InGameUILogicStateTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace GameDemo.Tests;

using Chickensoft.GoDotCollections;
using Chickensoft.Collections;
using Chickensoft.GoDotTest;
using Chickensoft.LogicBlocks;
using Godot;
Expand Down
1 change: 1 addition & 0 deletions test/src/player/PlayerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public void Loads() {
var chunk = new Mock<ISaveChunk<PlayerData>>();

var logic = new PlayerLogic();
logic.Set(_appRepo.Object);
logic.Start();

var data = new PlayerData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace GameDemo.Tests;

using Chickensoft.GoDotCollections;
using Chickensoft.Collections;
using Chickensoft.GoDotTest;
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
Expand Down
15 changes: 15 additions & 0 deletions test/src/player_camera/PlayerCameraTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace GameDemo.Tests;

using System.Threading.Tasks;
using Chickensoft.AutoInject;
using Chickensoft.Collections;
using Chickensoft.GodotNodeInterfaces;
using Chickensoft.GoDotTest;
using Chickensoft.GodotTestDriver;
Expand Down Expand Up @@ -204,6 +205,8 @@ public void Saves() {

var chunk = new Mock<ISaveChunk<PlayerCameraData>>();

_playerCam.CameraLogic.Get<PlayerCameraLogic.Data>().ShouldNotBeNull();

var data = _playerCam.PlayerCameraChunk.OnSave(chunk.Object);

data.GlobalTransform.ShouldBe(_playerCam.GlobalTransform);
Expand All @@ -219,6 +222,18 @@ public void Loads() {
var chunk = new Mock<ISaveChunk<PlayerCameraData>>();

var logic = new PlayerCameraLogic();
_gameRepo.Setup(g => g.IsMouseCaptured).Returns(new AutoProp<bool>(false));
_gameRepo.Setup(g => g.PlayerGlobalPosition)
.Returns(new AutoProp<Vector3>(Vector3.Zero));

logic.Set(_gameRepo.Object);
logic.Set(new PlayerCameraLogic.Data {
TargetPosition = Vector3.Zero,
TargetAngleHorizontal = 0f,
TargetAngleVertical = 0f,
TargetOffset = Vector3.Zero
});

logic.Start();

var data = new PlayerCameraData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace GameDemo.Tests;

using Chickensoft.GoDotCollections;
using Chickensoft.Collections;
using Chickensoft.GoDotTest;
using Chickensoft.LogicBlocks;
using Godot;
Expand Down

0 comments on commit e94ab40

Please sign in to comment.