コード例 #1
0
        public void InstanceOutputAttrsAreSpecified_Returns_True_If_Instance_Method_Is_Overriden()
        {
            // act
            var resource = new InstanceFilteredResource();

            // assert
            Assert.True(resource._instanceAttrsAreSpecified);
        }
コード例 #2
0
        public void Instance_Filter_Uses_NewExpression()
        {
            // arrange
            var model = new Model {
                AlwaysExcluded = "Joe"
            };
            var resource = new InstanceFilteredResource();

            // act
            var attrs = resource.GetOutputAttrs(model);

            // assert
            Assert.Empty(attrs);
        }
コード例 #3
0
        public void Instance_Filter_Uses_Member_Expression()
        {
            // arrange
            var model = new Model {
                AlwaysExcluded = "Admin"
            };
            var resource = new InstanceFilteredResource();

            // act
            var attrs = resource.GetOutputAttrs(model);

            // assert
            Assert.DoesNotContain(attrs, a => a.InternalAttributeName == nameof(Model.AlwaysExcluded));
        }
コード例 #4
0
        public void Instance_Filter_Uses_Member_Expression()
        {
            // arrange
            var model = new Model {
                AlwaysExcluded = "Admin"
            };
            var resource = new InstanceFilteredResource();

            // act
            var attrs = resource.GetOutputAttrs(model);

            // assert
            Assert.Single(attrs);
            Assert.Equal(nameof(Model.Password), attrs[0].InternalAttributeName);
        }