Exemple #1
0
        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());
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }