Example #1
0
        public RestTypeConfiguration <T> Entity <T>()
        {
            var typeConfig = new RestTypeConfiguration <T>(_convention);

            _types.Add(typeConfig);
            return(typeConfig);
        }
Example #2
0
        public void SettingStringKeyToInvalidPropertyShouldThrowException()
        {
            //arrange
            var target = new ModelBuilder();

            //act
            RestTypeConfiguration <Foo> restTypeConfiguration = target.Entity <Foo>();
            Action act = () => restTypeConfiguration.WithKey("id");

            //assert
            act.ShouldThrow <InvalidOperationException>();
        }
Example #3
0
        public void SettingStringKeyShouldPopulateKeySelector()
        {
            //arrange
            var target = new ModelBuilder();

            //act
            RestTypeConfiguration <Foo> restTypeConfiguration = target.Entity <Foo>();
            IRestTypeDefinition         typeDefinition        = (IRestTypeDefinition)restTypeConfiguration.WithKey("Id");

            ;

            //assert
            Assert.IsNotNull(typeDefinition.KeyProperty);
        }