public override void SetUp() { FluentDynamoDbConfiguration.Configure(Assembly.GetExecutingAssembly()); base.SetUp(); var fooMap = new FooMap(DynamoDbRootEntityConfiguration, DynamoDbMappingConfigurationFake.Object); }
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 async Task Foo() { /* * You must set your DynamoDb configuration @ app.config * * <appSettings> * <add key="AWSProfileName" value="" /> * <add key="AWSRegion" value="us-east-1" /> * <add key="AWSAccessKey" value=""/> * <add key="AWSSecretKey" value=""/> * </appSettings> * */ FluentDynamoDbConfiguration.Configure(Assembly.GetExecutingAssembly()); var userStore = new DynamoDbStore <User, Guid>(); var user = new User { Id = new Guid("1a9f6ee7-d0bf-47ab-a6f6-6225ebe713d8"), Name = "Luiz Freneda", BirthDate = new DateTime(1988, 05, 15), Gender = Gender.Male, Contact = new Contact { Email = "*****@*****.**", PhoneNumber = 963427000 } }; user.AddAccount(new Account { Balance = 9999.99m, Password = "******", Username = "******" }); user.AddAccount(new Account { Balance = 123.45m, Password = "******", Username = "******" }); await userStore.PutItem(user); var savedUser = await userStore.GetItem(new Guid("1a9f6ee7-d0bf-47ab-a6f6-6225ebe713d8")); savedUser.Name = "Luiz Freneda Perez Junior"; await userStore.UpdateItem(savedUser); await userStore.DeleteItem(new Guid("1a9f6ee7-d0bf-47ab-a6f6-6225ebe713d8")); Console.Read(); }