public RestTypeConfiguration <T> Entity <T>() { var typeConfig = new RestTypeConfiguration <T>(_convention); _types.Add(typeConfig); return(typeConfig); }
public void SettingStringKeyToInvalidPropertyShouldThrowException() { //arrange var target = new ModelBuilder(); //act RestTypeConfiguration <Foo> restTypeConfiguration = target.Entity <Foo>(); Action act = () => restTypeConfiguration.WithKey("id"); //assert act.ShouldThrow <InvalidOperationException>(); }
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); }