Skip to content

Commit

Permalink
Added Test Case to UploadCourseUseCaseTest.cs to test for Invalid ATF
Browse files Browse the repository at this point in the history
  • Loading branch information
philgei committed Jul 2, 2024
1 parent 32de066 commit b46fa42
Showing 1 changed file with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.Json;
using System.ComponentModel.DataAnnotations;
using System.Text.Json;
using AdLerBackend.Application.Common.DTOs;
using AdLerBackend.Application.Common.DTOs.Storage;
using AdLerBackend.Application.Common.Interfaces;
Expand Down Expand Up @@ -197,4 +198,28 @@ await _worldRepository.Received(1)
Assert.That(result.World3DUrl, Is.EqualTo("http://localhost"));
Assert.That(result.WorldLmsUrl, Is.EqualTo("http://localhost/course/view.php?id=1337"));
}

[Test]
public async Task Handle_InvalidCourseInformation_ThrowsValidationException()
{
// Arrange
var systemUnderTest =
new UploadWorldUseCase(_lmsBackupProcessor, _mediator, _fileAccess, _worldRepository,
_serialization, _ilms, _configuration);

var fakedValidDsl = new WorldAtfResponse()
{

};

_lmsBackupProcessor.GetWorldDescriptionFromBackup(Arg.Any<Stream>()).Returns(fakedValidDsl);

// Act & Assert
var exception = Assert.ThrowsAsync<ValidationException>(async () => await systemUnderTest.Handle(new UploadWorldCommand
{
BackupFileStream = new MemoryStream(),
ATFFileStream = new MemoryStream(),
WebServiceToken = "testToken"
}, CancellationToken.None));
}
}

0 comments on commit b46fa42

Please sign in to comment.