public void InstanceOutputAttrsAreSpecified_Returns_False_If_Instance_Method_Is_Not_Overriden() { // act var resource = new RequestFilteredResource(isAdmin: false); // assert Assert.False(resource._instanceAttrsAreSpecified); }
public void Request_Filter_Uses_Member_Expression() { // arrange var resource = new RequestFilteredResource(isAdmin: true); // act var attrs = resource.GetOutputAttrs(null); // assert Assert.DoesNotContain(attrs, a => a.InternalAttributeName == nameof(Model.AlwaysExcluded)); }
public void Request_Filter_Uses_Member_Expression() { // Arrange var resource = new RequestFilteredResource(isAdmin: true); // Act var attrs = resource.GetAllowedAttributes(); // Assert Assert.DoesNotContain(attrs, a => a.PropertyInfo.Name == nameof(Model.AlwaysExcluded)); }
public void Request_Filter_Uses_NewExpression() { // arrange var resource = new RequestFilteredResource(isAdmin: false); // act var attrs = resource.GetOutputAttrs(null); // assert Assert.Empty(attrs); }
public void Request_Filter_Uses_Member_Expression() { // arrange var resource = new RequestFilteredResource(isAdmin: true); // act var attrs = resource.GetOutputAttrs(null); // assert Assert.Single(attrs); Assert.Equal(nameof(Model.Password), attrs[0].InternalAttributeName); }
public void Request_Filter_Uses_NewExpression() { // Arrange var resource = new RequestFilteredResource(isAdmin: false); // Act var attrs = resource.GetAllowedAttributes(); // Assert Assert.DoesNotContain(attrs, a => a.InternalAttributeName == nameof(Model.AlwaysExcluded)); Assert.DoesNotContain(attrs, a => a.InternalAttributeName == nameof(Model.Password)); }
public void Property_Sort_Order_Uses_NewExpression() { // Arrange var resource = new RequestFilteredResource(isAdmin: false); // Act var sorts = resource.DefaultSort(); // Assert Assert.Equal(2, sorts.Count); Assert.Equal(nameof(Model.CreatedAt), sorts[0].Attribute.PropertyInfo.Name); Assert.Equal(SortDirection.Ascending, sorts[0].SortDirection); Assert.Equal(nameof(Model.Password), sorts[1].Attribute.PropertyInfo.Name); Assert.Equal(SortDirection.Descending, sorts[1].SortDirection); }