2019-11-08 23:38:06 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
using Storj;
|
|
|
|
|
|
|
|
|
|
namespace StorjTests
|
|
|
|
|
{
|
|
|
|
|
[TestClass]
|
|
|
|
|
public class ValidateBandwidthTests
|
|
|
|
|
{
|
|
|
|
|
[TestMethod]
|
|
|
|
|
[ExpectedExceptionWithMessage(typeof(ArgumentException), "The value cannot be empty.")]
|
|
|
|
|
public void NullBandwidth()
|
|
|
|
|
{
|
2019-11-14 12:02:03 +00:00
|
|
|
|
new CustomActionRunner().ValidateBandwidth(null);
|
2019-11-08 23:38:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
[ExpectedExceptionWithMessage(typeof(ArgumentException), "The value cannot be empty.")]
|
|
|
|
|
public void EmptyBandwidth()
|
|
|
|
|
{
|
2019-11-14 12:02:03 +00:00
|
|
|
|
new CustomActionRunner().ValidateBandwidth("");
|
2019-11-08 23:38:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
[ExpectedExceptionWithMessage(typeof(ArgumentException), "'some random text' is not a valid number.")]
|
|
|
|
|
public void InvalidNumber()
|
|
|
|
|
{
|
2019-11-14 12:02:03 +00:00
|
|
|
|
new CustomActionRunner().ValidateBandwidth("some random text");
|
2019-11-08 23:38:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
[ExpectedExceptionWithMessage(typeof(ArgumentException), "The allocated bandwidth cannot be less than 2 TB.")]
|
|
|
|
|
public void TooSmall()
|
|
|
|
|
{
|
2019-11-14 12:02:03 +00:00
|
|
|
|
new CustomActionRunner().ValidateBandwidth("1.41");
|
2019-11-08 23:38:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void ValidBandwidth()
|
|
|
|
|
{
|
2019-11-14 12:02:03 +00:00
|
|
|
|
new CustomActionRunner().ValidateBandwidth("3.14");
|
2019-11-08 23:38:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|