ex-int-04-shipping-cost/ShippingCosts.Test/PackageTests.cs
github-classroom[bot] 5db225db88
Initial commit
2025-04-29 15:01:53 +00:00

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);
}
}