public void PinResultErrorFromMemoization() { PinResult pinResult = new PinResult(ErrorMessage); Possible <string, Failure> maybe = pinResult.FromMemoization(RandomHelpers.CreateRandomCasHash(), CacheId); Assert.False(maybe.Succeeded); Assert.Contains(ErrorMessage, maybe.Failure.Describe()); }
public void PinResultSuccessFromMemoization() { PinResult pinResult = PinResult.Success; Possible <string, Failure> maybe = pinResult.FromMemoization(RandomHelpers.CreateRandomCasHash(), CacheId); Assert.True(maybe.Succeeded); Assert.Equal(CacheId, maybe.Result); }
public void PinResultMissFromMemoization() { PinResult pinResult = PinResult.ContentNotFound; CasHash hash = RandomHelpers.CreateRandomCasHash(); Possible <string, Failure> maybe = pinResult.FromMemoization(hash, CacheId); Assert.False(maybe.Succeeded); NoCasEntryFailure failure = maybe.Failure as NoCasEntryFailure; Assert.False(failure == null); string failureMessage = failure.Describe(); Assert.Contains(hash.ToString(), failureMessage); Assert.Contains(CacheId, failureMessage); }