47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using ShippingCosts.Implementations;
|
|
|
|
namespace ShippingCosts.Test;
|
|
|
|
public sealed class PackageTests
|
|
{
|
|
[Theory]
|
|
[InlineData(0, 0, 0, 0)]
|
|
[InlineData(-1, -2, -3, -4)]
|
|
[InlineData(5, -5, 5, -5)]
|
|
[InlineData(0, 5, 0, 5)]
|
|
public void Package_Invalid(int width, int height, int depth, double weight)
|
|
{
|
|
var package = new Package
|
|
{
|
|
Width = width,
|
|
Height = height,
|
|
Depth = depth,
|
|
Weight = weight
|
|
};
|
|
|
|
package.Width.Should().Be(width < 0 ? 0 : width);
|
|
package.Height.Should().Be(height < 0 ? 0 : height);
|
|
package.Depth.Should().Be(depth < 0 ? 0 : depth);
|
|
package.Weight.Should().Be(weight < 0 ? 0 : weight);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(1, 2, 3, 4)]
|
|
[InlineData(10, 20, 30, 40)]
|
|
[InlineData(5, 10, 15, 20)]
|
|
public void Package_Valid(int width, int height, int depth, double weight)
|
|
{
|
|
var package = new Package
|
|
{
|
|
Width = width,
|
|
Height = height,
|
|
Depth = depth,
|
|
Weight = weight
|
|
};
|
|
|
|
package.Width.Should().Be(width);
|
|
package.Height.Should().Be(height);
|
|
package.Depth.Should().Be(depth);
|
|
package.Weight.Should().Be(weight);
|
|
}
|
|
}
|