-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some refactoring to make testing easier & remove hard-coded initialisations Basic tests(Well test) for the adventure and support module
- Loading branch information
Showing
7 changed files
with
109 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Moq; | ||
using skullOS.Core; | ||
using skullOS.HardwareServices.Interfaces; | ||
using skullOS.Modules; | ||
|
||
namespace ModuleTests | ||
{ | ||
public class AdventureTest | ||
{ | ||
public AdventureTest() | ||
{ | ||
FileManager.CreateSkullDirectory(true, true); | ||
} | ||
|
||
[Fact] | ||
public void CanCreateAdventureModule() | ||
{ | ||
//string now = DateTime.Now.ToString("M"); | ||
//var directory = FileManager.GetSkullDirectory() + @"/Timelapse - " + now + @"/"; | ||
Mock<ICameraService> cameraMock = new(); | ||
cameraMock.Setup(camera => camera.TakePictureAsync(It.IsAny<string>())).Returns(Task.FromResult("Pass")); | ||
|
||
Adventure sut = new(cameraMock.Object); | ||
|
||
Assert.NotNull(sut); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Moq; | ||
using skullOS.HardwareServices.Interfaces; | ||
using skullOS.Modules; | ||
using System.Device.Gpio; | ||
|
||
namespace ModuleTests | ||
{ | ||
public class SupportTest | ||
{ | ||
[Fact] | ||
public void CanCreateSupportModule() | ||
{ | ||
Mock<ISpeakerService> speakerMock = new(); | ||
speakerMock.Setup(speaker => speaker.PlayAudio(It.IsAny<string>())).Returns(Task.CompletedTask); | ||
Mock<GpioController> gpioMock = new(); | ||
gpioMock.Setup(gpio => gpio.OpenPin(It.IsAny<int>())); | ||
gpioMock.Setup(gpio => gpio.RegisterCallbackForPinValueChangedEvent(It.IsAny<int>(), PinEventTypes.Rising, It.IsNotNull<PinChangeEventHandler>())); | ||
|
||
var SupportModule = new Support(gpioMock.Object, speakerMock.Object, 4); | ||
|
||
Assert.NotNull(SupportModule); | ||
} | ||
} | ||
} |
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
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