Exemple #1
0
        public void TestToModel(string cmd)
        {
            CmdSerializer <InParamModel> inParam = new CmdSerializer <InParamModel>(cmd.Split(' '));
            InParamModel inParamModel            = inParam.ToModel();

            Assert.IsTrue(inParamModel != null);
        }
Exemple #2
0
        public void TestOrder(string args)
        {
            TestServer server = new TestServer(base.RemoteTestEndpoint);
            CmdSerializer <InParamModel> cmdHelper = new CmdSerializer <InParamModel>(args.Split(' '));
            InParamModel inParam = cmdHelper.AddMatchedGroups().ToModel();

            server.Work();
            while (!server.IsWork)
            {
                ;
            }
            OutParamModel outParam = this._client.Order(inParam);

            Assert.IsTrue(outParam.Raw.IndexOf(inParam.Domain) > 0 && outParam.Raw.IndexOf(inParam.Address) > 0 && outParam.Raw.IndexOf("0000-00-00(00:00:00:00)") > 0);
        }
Exemple #3
0
        public static CmdSerializer <InParamModel> AddMatchedGroups(this CmdSerializer <InParamModel> cmdSerializer)
        {
            Type inParamType = typeof(InParamModel);

            cmdSerializer.AddMatchedGroup("--role", inParamType.GetProperty("Role"), "transverter", RoleType.Transverter);
            cmdSerializer.AddMatchedGroup("--role", inParamType.GetProperty("Role"), "provider", RoleType.Provider);
            cmdSerializer.AddMatchedGroup("--role", inParamType.GetProperty("Role"), "user", RoleType.User);
            cmdSerializer.AddMatchedGroup("--operation", inParamType.GetProperty("Operation"), "work", OperationType.Work);
            cmdSerializer.AddMatchedGroup("--operation", inParamType.GetProperty("Operation"), "unwork", OperationType.UnWork);
            cmdSerializer.AddMatchedGroup("--operation", inParamType.GetProperty("Operation"), "update", OperationType.Update);
            cmdSerializer.AddMatchedGroup("--operation", inParamType.GetProperty("Operation"), "get", OperationType.Get);
            cmdSerializer.AddMatchedGroup("--address", inParamType.GetProperty("Address"), "*", "*");
            cmdSerializer.AddMatchedGroup("--domain", inParamType.GetProperty("Domain"), "*", "*");
            cmdSerializer.AddMatchedGroup("--wait", inParamType.GetProperty("Others"), null, "--wait");
            return(cmdSerializer);
        }
Exemple #4
0
        private static void Input(string[] args)
        {
            CmdSerializer <InParamModel> cmdSerializer = new CmdSerializer <InParamModel>(args);

            InParam = cmdSerializer.AddMatchedGroups().ToModel();

            Config.Log(LogTypes.Input,
                       $"[role:{InParam.Role}] " +
                       $"[operation:{InParam.Operation}] " +
                       $"[domain:{InParam.Domain}] " +
                       $"[address:{InParam.Address}]");
            if (InParam == null)
            {
                throw new Exception("arg error.");
            }
        }