public void TestInitialize()
        {
            _mockModel = new Mock <IModel>();
            var mockTransaction = new Mock <ITransaction>();

            var mockReliableDict = new Mock <IReliableDictionary <long, IModel> >();

            mockReliableDict.Setup(x => x.AddAsync(mockTransaction.Object, 0, _mockModel.Object))
            .Callback(() => { _dictionary.Add(0, _mockModel.Object); })
            .Returns(Task.Delay(0));

            mockReliableDict.Setup(x => x.TryRemoveAsync(mockTransaction.Object, It.IsAny <long>()))
            .Callback((ITransaction tx, long id) =>
            {
                _dictionary.Remove(id);
            });

            mockReliableDict.Setup(x => x.SetAsync(mockTransaction.Object, It.IsAny <long>(), It.IsAny <IModel>()))
            .Callback((ITransaction tx, long id, IModel value) => { _dictionary[id] = value; });

            var mockStateManager = new Mock <IReliableStateManager>();

            mockStateManager
            .Setup(x => x.GetOrAddAsync <IReliableDictionary <long, IModel> >(Settings.Constants.ReliableDictionaryNames.TemplatingEngineReliableDictionaryName))
            .Returns(Task.Run(() => mockReliableDict.Object));

            mockStateManager
            .Setup(x => x.CreateTransaction())
            .Returns(mockTransaction.Object);

            _repo = new ReliableRepositoryAsync <IModel>(mockStateManager.Object);
        }
 public TemplatingEngine(StatefulServiceContext context)
     : base(context)
 {
     _reliableRepository = new ReliableRepositoryAsync <CommunicationsTemplateModel>(StateManager);
 }