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; }
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."); } }
public void Add(CachingValidationType type, bool isTrue) { this[type] = new CachingValidation(type, isTrue); }
public CachingValidation this[CachingValidationType key] { get { return(_validations[key]); } set { _validations[key] = value; } }