diff --git a/Server/ReasnAPI/ReasnAPI.Tests/Services/ImageServiceTests.cs b/Server/ReasnAPI/ReasnAPI.Tests/Services/ImageServiceTests.cs index 6e64fb45..5745330c 100644 --- a/Server/ReasnAPI/ReasnAPI.Tests/Services/ImageServiceTests.cs +++ b/Server/ReasnAPI/ReasnAPI.Tests/Services/ImageServiceTests.cs @@ -30,7 +30,8 @@ public void CreateImage_ImageDoesNotExist_ImageCreated() mockContext.Setup(c => c.Images).ReturnsDbSet(new List()); var imageService = new ImageService(mockContext.Object); - List imagedtoslist = [imageDto]; + List imagedtoslist = new List(); + imagedtoslist.Append(imageDto); var result = imageService.CreateImages(imagedtoslist); Assert.IsNotNull(result); @@ -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 imagedtoslist = [imageDto]; + List imagedtoslist = new List(); + imagedtoslist.Append(imageDto); + var result = imageService.CreateImages(imagedtoslist); - Assert.IsNull(result); + + mockContext.Verify(m => m.Add(It.IsAny()), Times.Never()); + mockContext.Verify(m => m.AddRange(It.IsAny>()), Times.Never()); } [TestMethod] @@ -64,7 +69,7 @@ public void GetAllImages_ImageExists_ImagesReturned() var imageService = new ImageService(mockContext.Object); var result = imageService.GetAllImages(); - + Assert.IsNotNull(result); } @@ -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]