Files
Bucket/Buckets.Test/ContainerTest.cs
KaseToatz1337 d3de812339 added events
2024-10-03 09:16:40 +02:00

67 lines
1.7 KiB
C#

using Buckets.Logic;
namespace Buckets.Test
{
[TestClass]
public class ContainerTest
{
[TestMethod]
public void Container_NegativeCapacity_ShouldThrow()
{
Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
{
Bucket container = new(-1, 0);
});
}
[TestMethod]
public void Container_NegativeContent_ShouldThrow()
{
Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
{
Bucket container = new(0, -1);
});
}
[TestMethod]
public void Container_ValidParameters_ShouldEqual10()
{
Bucket container = new(20, 10);
Assert.AreEqual(10, container.Content);
}
[TestMethod]
public void Fill_ValidParameters_ShouldEqual15()
{
Bucket container = new(20, 10);
container.Fill(5);
Assert.AreEqual(15, container.Content);
}
[TestMethod]
public void Empty_NegativeContent_ShouldThrow()
{
Bucket container = new(20, 10);
Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
{
container.Empty(20);
});
}
[TestMethod]
public void Empty_ValidParameters_ShouldEqual5()
{
Bucket container = new(20, 10);
container.Empty(5);
Assert.AreEqual(5, container.Content);
}
[TestMethod]
public void Empty_ValidParameters_ShouldEqual0()
{
Bucket container = new(20, 10);
container.Empty();
Assert.AreEqual(0, container.Content);
}
}
}