This repository was archived by the owner on Sep 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDataSheetPictureTests.cs
More file actions
57 lines (49 loc) · 1.64 KB
/
DataSheetPictureTests.cs
File metadata and controls
57 lines (49 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using ClosedXML.Excel.Drawings;
using Easify.Excel.ClosedXml;
using FluentAssertions;
using NSubstitute;
using Xunit;
namespace Easify.Excel.UnitTests.ClosedXml
{
public class DataSheetPictureTests
{
[Theory]
[InlineData(250, 50)]
[InlineData(100, 20)]
[InlineData(500, 100)]
[InlineData(200, 40)]
[InlineData(180, 36)]
public void Should_WithWidth_CalculateHeightCorrectly(int width, int expectedHeight)
{
// Arrange
var fakePicture = Substitute.For<IXLPicture>();
fakePicture.Height.Returns(100);
fakePicture.Width.Returns(500);
var sut = new DataSheetPicture(fakePicture);
// Act
var actual = sut.WithWidth(width);
// Assert
actual.Should().NotBeNull();
fakePicture.Received(1).WithSize(width, expectedHeight);
}
[Theory]
[InlineData(50 , 250)]
[InlineData(20, 100)]
[InlineData(100, 500)]
[InlineData(40, 200)]
[InlineData(36, 180)]
public void Should_WithHeight_CalculateWidthCorrectly(int height, int expectedWidth)
{
// Arrange
var fakePicture = Substitute.For<IXLPicture>();
fakePicture.Height.Returns(100);
fakePicture.Width.Returns(500);
var sut = new DataSheetPicture(fakePicture);
// Act
var actual = sut.WithHeight(height);
// Assert
actual.Should().NotBeNull();
fakePicture.Received(1).WithSize(expectedWidth, height);
}
}
}