Esempio n. 1
0
        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"));
        }
Esempio n. 3
0
        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"));
        }
Esempio n. 4
0
        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"));
        }
Esempio n. 5
0
 public void Start(String aConnectionString, params Type[] aTypes)
 {
     Config.Load(aConnectionString, aTypes);
     Loader.Load();
 }