예제 #1
0
        public void document_storage_should_get_all_type_items()
        {
            // arrange
            IEnumerable<AccountView> entities;
            var storage = new DocumentStorage(m_store);
            storage.AddEntity(new AccountID(Guid.NewGuid()), new AccountView());
            storage.AddEntity(new AccountID(Guid.NewGuid()), new AccountView());
            storage.AddEntity(new AccountID(Guid.NewGuid()), new AccountView());
            storage.AddEntity(new AccountID(Guid.NewGuid()), new AccountView());
            // act
            storage.TryGetAllEntities(out entities);
            var accountViews = entities as List<AccountView> ?? entities.ToList();

            // assert
            accountViews.ShouldNotBeEmpty();
            accountViews.Count().ShouldEqual(4);
        }
예제 #2
0
        public void document_storage_should_add()
        {
            // arrange
            var storage = new DocumentStorage(m_store);
            var bucket = m_strategy.GetEntityBucket<AccountView>();

            // act
            storage.AddEntity(m_accountID, m_account);

            // assert
            m_store.EnumerateContents(bucket).ShouldNotBeEmpty();
        }
예제 #3
0
        public void document_storage_should_update()
        {
            // arrange
            AccountView fetch;
            var storage = new DocumentStorage(m_store);
            storage.AddEntity(m_accountID, m_account);

            // act
            storage.UpdateEntity<AccountView>(m_accountID, a => a.Name = "New Name");
            storage.TryGetEntity(m_accountID, out fetch);

            // assert
            fetch.Name.ShouldEqual("New Name");
        }