ToKey() public method

public ToKey ( ) : string
return string
        public void FutureReceipt_ToKey_WhenRequestIDNotSet_ExpectException()
        {
            //------------Setup for test--------------------------
            var futureReciept = new FutureReceipt { PartID = 1, User = "******" };

            //------------Execute Test---------------------------
            futureReciept.ToKey();
        }
        public void FutureReceipt_ToKey_WhenPartIDLessThenZero_ExpectException()
        {
            //------------Setup for test--------------------------
            var futureReciept = new FutureReceipt { PartID = -1, RequestID = RequestID, User = "******" };

            //------------Execute Test---------------------------
            futureReciept.ToKey();
        }
        public void FutureReceipt_ToKey_WhenValidKeyParts_ExpectKey()
        {
            //------------Setup for test--------------------------
            var futureReciept = new FutureReceipt { PartID = 1, RequestID = RequestID, User = "******" };

            //------------Execute Test---------------------------
            var result = futureReciept.ToKey();

            //------------Assert Results-------------------------
            StringAssert.Contains(result, RequestID+"-1-Bob!");
        }
Esempio n. 4
0
        public string FetchResult(FutureReceipt receipt)
        {
            if (receipt == null)
            {
                throw new ArgumentNullException("receipt");
            }

            if (!_resultCache.TryRemove(receipt.ToKey(), out string result))
            {
                result = string.Empty;
            }
            return(result);
        }
Esempio n. 5
0
        public bool AddResult(FutureReceipt receipt, string payload)
        {
            if (string.IsNullOrEmpty(payload))
            {
                throw new ArgumentNullException("payload");
            }

            if (receipt == null)
            {
                throw new ArgumentNullException("receipt");
            }

            return(_resultCache.TryAdd(receipt.ToKey(), payload));
        }
        public string FetchResult(FutureReceipt receipt)
        {
            if(receipt == null)
            {
                throw new ArgumentNullException("receipt");
            }

            string result;
            if(!_resultCache.TryRemove(receipt.ToKey(), out result))
            {
                result = string.Empty;
            }
            return result;
        }
        public bool AddResult(FutureReceipt receipt, string payload)
        {
            if(string.IsNullOrEmpty(payload))
            {
                throw new ArgumentNullException("payload");
            }

            if(receipt == null)
            {
                throw new ArgumentNullException("receipt");
            }

            return _resultCache.TryAdd(receipt.ToKey(), payload);
        }
        public void FutureReceipt_ToKey_WhenUserNull_ExpectException()
        {
            //------------Setup for test--------------------------
            var futureReciept = new FutureReceipt { PartID = 1, RequestID = RequestID, User = null };

            //------------Execute Test---------------------------
            futureReciept.ToKey();
        }