public void WhenSeedNotGiven_ShouldMaintainValuesLength() { // Arrange var fixture = new Fixture(); var values = fixture.Create <byte[]>(); var expected = values.Length; var algorithm = new Mock <IHashAlgorithm <int> >(MockBehavior.Strict); algorithm.Setup(m => m.ComputeHash(It.Is <byte[]>(b => b != null && b.Length == expected))) .Returns(() => default(int)) .Verifiable(); var provider = new SeededHashingService <int>(algorithm.Object); // Act var actual = provider.ComputeHash(new byte[expected]); // Assert algorithm.VerifyAll(); }
public void WhenValuesGivenAsBytes_ShouldReturnFromAlgorithm() { // Arrange var fixture = new Fixture(); var values = fixture.Create <byte[]>(); var expected = fixture.Create <int>(); var algorithm = new Mock <IHashAlgorithm <int> >(MockBehavior.Strict); algorithm.Setup(m => m.ComputeHash(It.IsNotNull <byte[]>())) .Returns(() => expected) .Verifiable(); var provider = new SeededHashingService <int>(algorithm.Object); // Act var actual = provider.ComputeHash(values); // Assert Assert.AreEqual(expected, actual); algorithm.VerifyAll(); }