1
Vote

Load fails after second sorage

description

Hello,
 
I am trying out some cases with LoungeRepository in order to learn something about DDD and programing C#.
 
I want to implement a sequence like structure that generates integer ids. The current value of that sequence should be stored into the LoungeRepository.
 
Storing a value twice under the same key and change its value in between the two storages results in an error when loading that value. Loading seems to return always the value that was stored in the first time.
 
Is that a bug in the LoungRepository or is there a mistake in the test code example anywhere? Maybe these are are transaction issues?
 
The following Test fails:
 
    [Test]
    public void Load_after_restore_changed_value()
    {
        const String ID = "nextId";
 
        using (LoungeRepository sut = new LoungeRepository("C:\\repos"))
        {    
            // Store nonEntityObject
            Int64 nextId = 0;
            sut.Store(nextId, ID);
            nextId = sut.Load<Int64>(ID);
            Assert.AreEqual(0, nextId);
 
            //Change nonEntityObject and restore it
            nextId++;
            sut.Store(nextId, ID);

            //! Load fails: Expected 1 but was 0
            nextId = sut.Load<Int64>(ID);
            Assert.AreEqual(1, nextId);
        }
    }
 
Best Regards,
 
Ortvin

comments