Skip to content

Commit

Permalink
one more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bilimig committed May 2, 2024
1 parent 928dd6a commit 281bf87
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Server/ReasnAPI/ReasnAPI.Tests/Services/ImageServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public void CreateImage_ImageDoesNotExist_ImageCreated()
mockContext.Setup(c => c.Images).ReturnsDbSet(new List<Image>());

var imageService = new ImageService(mockContext.Object);
List<ImageDto> imagedtoslist = [imageDto];
List<ImageDto> imagedtoslist = new List<ImageDto>();
imagedtoslist.Append(imageDto);

var result = imageService.CreateImages(imagedtoslist);
Assert.IsNotNull(result);
Expand All @@ -49,9 +50,13 @@ public void CreateImage_ImageExists_ImageNotCreated()
{ new Image { ImageData = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 } } });

var imageService = new ImageService(mockContext.Object);
List<ImageDto> imagedtoslist = [imageDto];
List<ImageDto> imagedtoslist = new List<ImageDto>();
imagedtoslist.Append(imageDto);

var result = imageService.CreateImages(imagedtoslist);
Assert.IsNull(result);

mockContext.Verify(m => m.Add(It.IsAny<Image>()), Times.Never());
mockContext.Verify(m => m.AddRange(It.IsAny<IEnumerable<Image>>()), Times.Never());
}

[TestMethod]
Expand All @@ -64,7 +69,7 @@ public void GetAllImages_ImageExists_ImagesReturned()
var imageService = new ImageService(mockContext.Object);

var result = imageService.GetAllImages();

Assert.IsNotNull(result);
}

Expand All @@ -77,8 +82,8 @@ public void GetAllImages_ImageNotExists_EmptyListReturned()
var imageService = new ImageService(mockContext.Object);

var result = imageService.GetAllImages().ToList();
Assert.AreEqual(0,result.Count);

Assert.AreEqual(0, result.Count);
}

[TestMethod]
Expand Down

0 comments on commit 281bf87

Please sign in to comment.