public TestStructValue() { mt1.PutValidator(mf1, Validator_boolean.Get(0)); mt1.PutValidator(mf2, Validator_boolean.Get(1)); mt1.PutValidator(mf3, Validator_int.Get(0)); mt1.PutValidator(mf4, Validator_int.Get(1)); mt1.PutValidator(mf5, Validator_string.Get(0)); mt1.PutValidator(mf6, Validator_string.Get(1)); }
private void Test(int n, String s, Object good, Object bad) { Validator_int v1 = Validator_int.Get(n); Validator_boolean v2 = Validator_boolean.Get(n); ComboValidator v = new ComboValidator(v1, v2); Assert.AreEqual(s, v.ToString()); Assert.IsTrue(v.Validate(good)); Assert.IsFalse(v.Validate(bad)); if (n > 0) { v.ElementValidator(); } }
public void Test_boolean() { // 2 dimensional bool[][] array1 = new bool[][] { new bool[] { false, true }, new bool[] { true, false } }; TestX(array1, Validator_boolean.Get(2)); // 3 dimensional TestX( new bool[][][] { new bool[][] { new bool[] { true, false, false }, new bool[] { true, false, true } }, new bool[][] { new bool[] { false, true, false }, new bool[] { false, true, false } }, new bool[][] { new bool[] { false, false, false }, new bool[] { true, true, true } } }, Validator_boolean.Get(3)); }
public void Test5() { Validator v1 = Validator_boolean.Get(1); Validator v2 = Validator_int.Get(1); Validator v = new ComboValidator(v1, v2); Assert.IsTrue(v.Validate(new Boolean[] {})); Assert.IsTrue(v.Validate(new int[] {})); v = v.ElementValidator(); Assert.IsTrue(v.Validate(true)); Assert.IsTrue(v.Validate(false)); Assert.IsTrue(v.Validate(0)); v = v.ElementValidator(); }
public PwAuth(TransportMessage transport, URL uri, Resources resources) : base(transport, uri, resources) { server = (Boolean)transport.TransportQuery(TransportConsts.IS_SERVER); if (!server) { user = uri.User; password = uri.Password; } // Log.report( "KeepAliveInstalled", // "delay", delay, "count", count, "server", server ); vf = (ValueFactory)resources.Get(TransportConsts.VALUE_FACTORY); mt_request = new XType("_Etch_PwAuthReq"); mt_response = new XType("_Etch_PwAuthResp"); vf.AddType(mt_request); vf.AddType(mt_response); mf_user = new Field("user"); mf_password = new Field("password"); mf_ok = new Field("ok"); mf_status = new Field("status"); mt_request.PutValidator(mf_user, Validator_string.Get(0)); mt_request.PutValidator(mf_password, Validator_string.Get(0)); mt_request.SetResult(mt_response); mt_request.Lock(); mt_response.PutValidator(mf_ok, Validator_boolean.Get(0)); mt_response.PutValidator(mf_status, Validator_string.Get(0)); mt_response.Lock(); }