public void TestHighestRule() { //Arrange Parcel p = new Parcel(51, 10, 10, 10); //Act Tuple<string, double> output = RuleEngine.ApplyRule(p); //Assert Assert.AreEqual(output.Item1, "Rejected"); Assert.AreEqual(output.Item2, double.NaN); }
public void TestFourthRule() { //Arrange Parcel p = new Parcel(10, 750, 2, 1); //Act Tuple<string, double> output = RuleEngine.ApplyRule(p); //Assert Assert.AreEqual(output.Item1, "Medium Parcel"); Assert.AreEqual(output.Item2, (750d * 2 * 1) * 0.04); }
public void TestInvalidValues() { try { //Arrange & Act Parcel p = new Parcel(-1,1,2,3); } catch(Exception ex) { //Assert Assert.AreEqual(ex.Message, "Invalid Value for Weight"); } try { //Arrange & Act Parcel p = new Parcel(1, 0, 2, 3); } catch (Exception ex) { //Assert Assert.AreEqual(ex.Message, "Invalid Value for Height"); } try { //Arrange & Act Parcel p = new Parcel(1, 1, -2, 3); } catch (Exception ex) { //Assert Assert.AreEqual(ex.Message, "Invalid Value for Width"); } try { //Arrange & Act Parcel p = new Parcel(1, 1, 2, -3); } catch (Exception ex) { //Assert Assert.AreEqual(ex.Message, "Invalid Value for Depth"); } }
public void TestThirdRule() { //Arrange Parcel p = new Parcel(10, 745, 2, 1); //Act Tuple<string, double> output = RuleEngine.ApplyRule(p); //Assert Assert.AreEqual(output.Item1, "Small Parcel"); Assert.AreEqual(output.Item2, (745d*2*1) * 0.05); }
public void TestSeondRule() { //Arrange Parcel p = new Parcel(11, 10, 10, 10); //Act Tuple<string, double> output = RuleEngine.ApplyRule(p); //Assert Assert.AreEqual(output.Item1, "Heavy Parcel"); Assert.AreEqual(output.Item2, 15*11); }
public void TestLowestRule() { //Arrange Parcel p = new Parcel(10, 1250, 2, 1); //Act Tuple<string, double> output = RuleEngine.ApplyRule(p); //Assert Assert.AreEqual(output.Item1, "Large Parcel"); Assert.AreEqual(output.Item2, (1250d * 2 * 1) * 0.03); }