62 lines
1.6 KiB
C#
62 lines
1.6 KiB
C#
using Buckets.Logic;
|
|
|
|
namespace Buckets.Test
|
|
{
|
|
[TestClass]
|
|
public class BucketTest
|
|
{
|
|
[TestMethod]
|
|
public void Bucket_DefaultCapacity_ShouldEqual12()
|
|
{
|
|
Bucket bucket = new(0);
|
|
Assert.AreEqual(12, bucket.Capacity);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Bucket_LowCapacity_ShouldThrow()
|
|
{
|
|
Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
|
|
{
|
|
Bucket bucket = new(5, 0);
|
|
});
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Bucket_HighCapacity_ShouldThrow()
|
|
{
|
|
Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
|
|
{
|
|
Bucket bucket = new(2501, 0);
|
|
});
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Fill_BucketOverCapacity_ShouldThrow()
|
|
{
|
|
Bucket bucket = new(10, 0);
|
|
Bucket bucket2 = new(20, 20);
|
|
Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
|
|
{
|
|
bucket.Fill(bucket2);
|
|
});
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Fill_SecondBucket_ShouldEqual0()
|
|
{
|
|
Bucket bucket = new(20, 0);
|
|
Bucket bucket2 = new(20, 10);
|
|
bucket.Fill(bucket2);
|
|
Assert.AreEqual(0, bucket2.Content);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void Fill_Bucket_ShouldEqual20()
|
|
{
|
|
Bucket bucket = new(20, 10);
|
|
Bucket bucket2 = new(20, 10);
|
|
bucket.Fill(bucket2);
|
|
Assert.AreEqual(20, bucket.Content);
|
|
}
|
|
}
|
|
} |