Part 1 & 2
This commit is contained in:
62
Buckets.Test/BucketTest.cs
Normal file
62
Buckets.Test/BucketTest.cs
Normal file
@ -0,0 +1,62 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user