Exemplo n.º 1
0
        public async Task CanHandleEntityTypeWithStringBasedPartition()
        {
            Expression <Func <DocumentDbFoo1, string> > expression = x => x.MyStringCategory;
            var configurations = GetBaseConfigurations <DocumentDbFoo1>((MemberExpression)expression.Body);

            TableStorageRepository.Configure(typeof(DocumentDbFoo1), configurations);

            const string id = "3";

            await TableStorageRepository.AddAsync(new DocumentDbFoo1
            {
                Id               = id,
                Name             = "Foo 1",
                MyStringCategory = "cat 1"
            }, null);

            await TableStorageRepository.UpdateAsync(new DocumentDbFoo1
            {
                Id               = id,
                Name             = "Foo 1 v2",
                MyStringCategory = "cat 1"
            }, null);

            try
            {
                var item = (await GetByIdAsync <DocumentDbFoo1>(id)).Single();

                item.Name.ShouldBe("Foo 1 v2");
            }
            finally
            {
                TableStorageRepository.DeleteAllAsync <DocumentDbFoo1>(null).GetAwaiter().GetResult();
            }
        }
Exemplo n.º 2
0
        public TableStorageRepositoryQueryTests()
        {
            Expression <Func <DocumentDbFoo3, string> > expression = x => x.Category;
            var configurations = GetBaseConfigurations <DocumentDbFoo3>((MemberExpression)expression.Body);

            TableStorageRepository.Configure(typeof(DocumentDbFoo3), configurations);

            _accessor = TypeAccessor.Create(_type);
            _members  = _accessor.GetMembers();
        }
        public TableStorageRepositoryQueryTests()
        {
            Expression <Func <DocumentDbFoo3, string> > expression = x => x.Category;

            "TableStorageRepositoryQueryTests instantiated and loading config.".Log();
            var configurations = GetBaseConfigurations <DocumentDbFoo3>((MemberExpression)expression.Body);

            "Configuring TableStorageRepository.".Log();
            TableStorageRepository.Configure(typeof(DocumentDbFoo3), configurations);

            "Creating TableStorageRepositoryQueryTests accessor type.".Log();

            _accessor = TypeAccessor.Create(_type);
            _members  = _accessor.GetMembers();

            "TableStorageRepositoryQueryTests constructor.".Log();
        }