public void TestConvertInput(Type type, string propertyId, string input, bool expectedValid) { // Arrange _coll = ExpressionPropertiesHelper.LoadPropertyCollection(type); //_coll = new ExpressionPropertyCollection<TItemType>(); _coll.LoadProperties(null); // Act var result = _coll.ConvertInput(propertyId, input, out var isValid); // Assert Assert.AreEqual(expectedValid, isValid); if (isValid) { Assert.IsNotNull(result); } else { Assert.IsNull(result); } }
public void TestValidate(Type type, string propertyName, string input, bool expectedValid) { // Arrange _coll = ExpressionPropertiesHelper.LoadPropertyCollection(type); //_coll = new ExpressionPropertyCollection<TItemType>(); _coll.LoadProperties(null); // Act var result = _coll.Validate(propertyName, input); foreach (var p in _coll.ToList()) { Debug.Print(p.Id); } // Assert Assert.AreEqual(expectedValid, result); }
public void TestLoadPropertiesNoResourceManager() { // Act _coll = ExpressionPropertiesHelper.LoadPropertyCollection(typeof(Person)); _coll.LoadProperties(null); // Assert var count = _coll.Count; Assert.IsTrue(count > 0); var result = _coll.ToList(); Assert.IsNotNull(result); Assert.AreEqual(count, result.Count); Assert.IsTrue(result.Any(x => x.Id == "Checker")); Assert.IsTrue(result.Any(x => x.Id == "Birth.Date")); Assert.IsTrue(result.Any(x => x.Id == "Money")); Assert.IsTrue(result.Any(x => x.Id == "Id")); Assert.IsTrue(result.Any(x => x.Id == "Name")); }
public void Setup() { _coll = null; }