Beispiel #1
0
        public void GenericOperationConverterTest()
        {
            OperationConverter gOpCnv = new OperationConverter();
            NameValueContext   c      = new NameValueContext();
            InvokeMethod       op     = new InvokeMethod(this, "TestMethod", new object[] { c });
            TestGenOp          genOp  = new TestGenOp();

            Assert.AreEqual(true, gOpCnv.CanConvert(genOp.GetType(), typeof(IOperation <object>)));
            Convert.ToString(gOpCnv.Convert(genOp, typeof(IOperation <object>)).GetType());
            Assert.AreEqual(true, gOpCnv.Convert(genOp, typeof(IOperation <object>)) is IOperation <object>);
            ((IOperation <object>)gOpCnv.Convert(genOp, typeof(IOperation <object>))).Execute(c);
            Assert.AreEqual("a", c["b"]);

            Assert.AreEqual(true, gOpCnv.CanConvert(op.GetType(), typeof(IOperation <NameValueContext>)));
            Assert.AreEqual(true, gOpCnv.Convert(op, typeof(IOperation <NameValueContext>)) is IOperation <NameValueContext>);
            ((IOperation <NameValueContext>)gOpCnv.Convert(op, typeof(IOperation <NameValueContext>))).Execute(c);
            Assert.AreEqual("b", c["a"]);

            // compatible conversion between IOperation<>
            Assert.AreEqual(true, gOpCnv.CanConvert(typeof(IOperation <Context>), typeof(IOperation <NameValueContext>)));
            Assert.AreEqual(true, gOpCnv.CanConvert(typeof(IOperation <NameValueContext>), typeof(IOperation <Context>)));
            IOperation <NameValueExContext> genOpEx = (IOperation <NameValueExContext>)gOpCnv.Convert(genOp, typeof(IOperation <NameValueExContext>));
            NameValueExContext cEx = new NameValueExContext();

            genOpEx.Execute(cEx);
            Assert.AreEqual("a", cEx["b"]);
        }
Beispiel #2
0
        public void TestMethod1()
        {
            var queryName = "TestQuery";
            var query     = Query.Empty(queryName);
            var nameField = Field.Simple("name");

            query.AddField(nameField);

            var converter = new OperationConverter();

            var operationAsString = converter.ConvertToString(query);

            "".ToString();
        }
        public async Task <ResponseQuery> GetOperationByIdAsync(string id, CancellationToken ct = default(CancellationToken))
        {
            var operation = OperationConverter.ConvertList(await _operationRepository.GetByIdAsync(id, ct));

            return(operation);
        }
        public async Task <ResponseQuery> GetAllOperationAsync(CancellationToken ct = default(CancellationToken))
        {
            var operations = OperationConverter.ConvertList(await _operationRepository.GetAllAsync(ct));

            return(operations);
        }