public void GetAll_ZeroMagnitudeIgnored() { // Arrange Func <byte> magnitude = () => 0; string bypassedBy = "—"; var drt = new DamageReductionTracker(); drt.Add(magnitude, bypassedBy); // Act var result = drt.GetAll(); // Assert Assert.IsEmpty(result); }
public void GetAll_SimpleCase() { // Arrange Func <byte> magnitude = () => 1; string bypassedBy = "—"; var drt = new DamageReductionTracker(); drt.Add(magnitude, bypassedBy); // Act var result = drt.GetAll(); // Assert Assert.AreEqual(1, result.Length); Assert.AreEqual(1, result[0].Magnitude()); Assert.AreEqual("—", result[0].BypassedBy); }
public void GetAll_IgnoresCapitalizationDifferences() { // Arrange Func <byte> lowMagnitude = () => 1; Func <byte> highMagnitude = () => 2; string lowercase = "silver"; string uppercase = "Silver"; var drt = new DamageReductionTracker(); drt.Add(lowMagnitude, lowercase); drt.Add(highMagnitude, uppercase); // Act var result = drt.GetAll(); // Assert Assert.AreEqual(1, result.Length); Assert.AreEqual(2, result[0].Magnitude()); }
public void GetAll_BothTypesReturned() { // Arrange Func <byte> magnitude = () => 1; string bypassedBy1 = "—"; string bypassedBy2 = "Silver"; var drt = new DamageReductionTracker(); drt.Add(magnitude, bypassedBy1); drt.Add(magnitude, bypassedBy2); // Act var result = drt.GetAll(); // Assert Assert.AreEqual(2, result.Length); Assert.IsTrue(result.Any(dr => bypassedBy1 == dr.BypassedBy)); Assert.IsTrue(result.Any(dr => bypassedBy2 == dr.BypassedBy)); }
public void GetAll_MaxOfEachTypeReturned() { // Arrange Func <byte> lowMagnitude = () => 1; Func <byte> highMagnitude = () => 2; string bypassedBy1 = "—"; string bypassedBy2 = "Silver"; var drt = new DamageReductionTracker(); drt.Add(lowMagnitude, bypassedBy1); drt.Add(highMagnitude, bypassedBy1); drt.Add(lowMagnitude, bypassedBy2); drt.Add(highMagnitude, bypassedBy2); // Act var result = drt.GetAll(); // Assert Assert.AreEqual(2, result.Length); Assert.IsTrue(result.Any(dr => bypassedBy1 == dr.BypassedBy && 2 == dr.Magnitude())); Assert.IsTrue(result.Any(dr => bypassedBy2 == dr.BypassedBy && 2 == dr.Magnitude())); }