Ejemplo n.º 1
0
        public void EqualGuid()
        {
            var x      = ODataDynamic.Expression;
            var filter = x.LinkID == Guid.Empty;

            Assert.Equal(string.Format("LinkID eq {0}", FormatSettings.GetGuidFormat("00000000-0000-0000-0000-000000000000")), filter.AsString(_session));
        }
        public void FindByGuidKey()
        {
            var key     = new Guid("BEC6C966-8016-46D0-A3D1-99D69DF69D74");
            var command = _client
                          .For <TypeWithGuidKey>()
                          .Key(key);
            var commandText = command.GetCommandTextAsync().Result;

            Assert.Equal($"TypeWithGuidKey({Uri.EscapeDataString(FormatSettings.GetGuidFormat(key.ToString()))})", commandText);
        }
        public void FindByGuidFilterEqual()
        {
            var key     = new Guid("D8F3F70F-C185-49AB-9A92-0C86C344AB1B");
            var command = _client
                          .For <TypeWithGuidKey>()
                          .Filter(x => x.Key == key);
            var commandText = command.GetCommandTextAsync().Result;

            Assert.Equal($"TypeWithGuidKey({Uri.EscapeDataString(FormatSettings.GetGuidFormat(key.ToString()))})", commandText);
        }
    public async Task FindByGuidKey()
    {
        var key     = new Guid("BEC6C966-8016-46D0-A3D1-99D69DF69D74");
        var command = _client
                      .For <TypeWithGuidKey>()
                      .Key(key);
        var commandText = await command.GetCommandTextAsync().ConfigureAwait(false);

        Assert.Equal($"TypeWithGuidKey({Uri.EscapeDataString(FormatSettings.GetGuidFormat(key.ToString()))})", commandText);
    }
        public void FindByGuidKey()
        {
            var key     = Guid.NewGuid();
            var command = _client
                          .For <TypeWithGuidKey>()
                          .Key(key);
            string commandText = command.GetCommandTextAsync().Result;

            Assert.Equal(string.Format("TypeWithGuidKey({0})", Uri.EscapeDataString(FormatSettings.GetGuidFormat(key.ToString()))), commandText);
        }
    public void EqualGuid()
    {
        Expression <Func <TestEntity, bool> > filter = x => x.LinkID == Guid.Empty;

        Assert.Equal($"LinkID eq {FormatSettings.GetGuidFormat("00000000-0000-0000-0000-000000000000")}", ODataExpression.FromLinqExpression(filter).AsString(_session));
    }