public void NullArgumentShouldThrowArgumentNullExceptionTest(bool hashImplIsNull, bool streamIsNull) { // arrange IImageHash imageHashImplementation = hashImplIsNull ? null : A.Dummy <IImageHash>(); Stream stream = streamIsNull ? null : new MemoryStream(); // act Action act = () => Sut.Hash(imageHashImplementation, stream); // assert act.Should().Throw <ArgumentNullException>(); }
public void HashStreamShouldReadStreamAsImageAndPassDataToHashAlgorithmTest() { // arrange const string filename = "Alyson_Hannigan_500x500_0.jpg"; A.CallTo(() => hashAlgorithm.Hash(A <Image <Rgba32> > ._)).Returns(0UL); using (var stream = TestHelper.OpenStream(filename)) { // act var result = Sut.Hash(hashAlgorithm, stream); // assert A.CallTo(() => hashAlgorithm.Hash(A <Image <Rgba32> > ._)).MustHaveHappenedOnceExactly(); result.Should().Be(0UL); } }