86 lines
2.3 KiB
C#
86 lines
2.3 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_ContentLargerThanCapacity_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_ContentLargerThanCapacity_ShouldThrow()
|
|
{
|
|
Bucket container = new(20, 10);
|
|
Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
|
|
{
|
|
container.Fill(20);
|
|
});
|
|
}
|
|
|
|
[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);
|
|
}
|
|
}
|
|
} |