public void LoadMapper_GivenFooClass_ShouldCreateInstanceOfFooMap() { FluentDynamoDbConfiguration.Configure(Assembly.GetExecutingAssembly()); var classMapLoader = new ClassMapLoader(); var classMap = classMapLoader.Load <Foo>(); Assert.IsInstanceOf <FooMap>(classMap); }
public void LoadMapper_GivenFooClassWithNoClassMap_ShouldThrownException() { FluentDynamoDbConfiguration.Configure(Assembly.GetExecutingAssembly()); var classMapLoader = new ClassMapLoader(); Assert.That(() => classMapLoader.Load <Foo>(), Throws.Exception .TypeOf <FluentDynamoDbMappingException>() .With .Message .EqualTo( "Could not find mapping for class of type FluentDynamoDb.Tests.Mappers.ClassMapLoaderMissingClassMapTests+Foo")); }
public void LoadMapper_GivenFooClassAndFooMapWithPrivateConstructor_ShouldThrowsException() { FluentDynamoDbConfiguration.Configure(Assembly.GetExecutingAssembly()); var classMapLoader = new ClassMapLoader(); Assert.That(() => classMapLoader.Load <Foo>(), Throws.Exception .TypeOf <FluentDynamoDbMappingException>() .With .Message .EqualTo( "Could not create a instance of type FluentDynamoDb.Tests.Mappers.ClassMapLoaderMissingPublicConstructorClassMapTests+FooMap, class must provide a public constructor")); }
public void LoadMapper_FluentDynamoDbConfigurationConfigureWasNotSet_ShouldThrowsException() { FluentDynamoDbConfiguration.Configure(null); var classMapLoader = new ClassMapLoader(); Assert.That(() => classMapLoader.Load <Foo>(), Throws.Exception .TypeOf <FluentDynamoDbMappingException>() .With .Message .EqualTo( "ClassMapLocationAssembly was not provided, you should run FluentDynamoDbConfiguration.Configure() to define a assembly location for mappers")); }
public void Start(String aConnectionString, params Type[] aTypes) { Config.Load(aConnectionString, aTypes); Loader.Load(); }