public void WhereById() { var result = SimpleClassDataContract.CreateQuery().OData().Filter($"{nameof(SimpleClassDataContract.Id)} eq 1").ToArray(); Assert.Single(result); Assert.Equal(1, result[0].Id); }
public void WhereByChangedName() { var result = SimpleClassDataContract.CreateQuery().OData().Filter("nameChanged eq 'n1'").ToArray(); Assert.Single(result); Assert.Equal(1, result[0].Id); }
public void SelectDataMember() { ISelectExpandWrapper[] result = SimpleClassDataContract.CreateQuery().OData().SelectExpand("nameChanged").ToArray(); IDictionary <string, object> metadata = result[0].ToDictionary(); // Expect Name to be selected Assert.Equal(1, metadata.Count); Assert.Equal("nameChanged", metadata.Single().Key); Assert.Equal("n1", metadata.Single().Value); Assert.IsType <string>(metadata.Single().Value); }
public void WhereByNotMarkedThrowException() { Assert.Throws <ODataException>(() => SimpleClassDataContract.CreateQuery().OData() .Filter($"{nameof(SimpleClassDataContract.NameNotMarked)} eq 'nm1'")); }
public void WhereByIgnoredMemberThrowException() { Assert.Throws <ODataException>(() => SimpleClassDataContract.CreateQuery().OData() .Filter($"{nameof(SimpleClassDataContract.NameToIgnore)} eq 'ign1'")); }