예제 #1
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>();
        }
예제 #2
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);
        }