Esempio n. 1
0
        public CachingValidation(CachingValidationType type, bool isTrue)
        {
            IsTrue = isTrue;
            Type   = type;

            Messages messages;

            if (!validationMessages.TryGetValue(type, out messages))
            {
                throw new ArgumentException($"The caching validation type '{type}' does not have messages configured.", nameof(type));
            }

            Message = isTrue ? messages.True : messages.False;
        }
Esempio n. 2
0
        public void Assert(CachingValidationType type, bool isTrue)
        {
            CachingValidation validation;

            Xunit.Assert.True(_validations.TryGetValue(type, out validation), $"No validation of type '{type}' was found.");

            if (isTrue)
            {
                Xunit.Assert.True(validation.IsTrue, $"The validation '{validation.Message}' ('{validation.Type}') was expected to be true and was not.");
            }
            else
            {
                Xunit.Assert.False(validation.IsTrue, $"The validation '{validation.Message}' ('{validation.Type}') was expected to be false and was not.");
            }
        }
Esempio n. 3
0
 public void Add(CachingValidationType type, bool isTrue)
 {
     this[type] = new CachingValidation(type, isTrue);
 }
Esempio n. 4
0
 public CachingValidation this[CachingValidationType key]
 {
     get { return(_validations[key]); }
     set { _validations[key] = value; }
 }