Esempio n. 1
0
        public void TestThatStateStoreWritesAndReadsObject()
        {
            var access1 = _interest.AfterCompleting <Entity1, Entity1>(2);

            _dispatcher.AfterCompleting(2);

            var entity = new Entity1("123", 5);

            _store.Write(entity.Id, entity, 1, _interest);
            _store.Read <Entity1>(entity.Id, _interest);

            Assert.Equal(1, access1.ReadFrom <int>("readObjectResultedIn"));
            Assert.Equal(1, access1.ReadFrom <int>("writeObjectResultedIn"));
            Assert.Equal(Result.Success, access1.ReadFrom <Result>("objectReadResult"));
            Assert.Equal(entity, access1.ReadFrom <Entity1>("objectState"));

            var readEntity = access1.ReadFrom <Entity1>("objectState");

            Assert.Equal("123", readEntity.Id);
            Assert.Equal(5, readEntity.Value);
        }