Exemple #1
0
        protected void CreateExistingItemAndMetaDataItem()
        {
            _existingItem = new HistoryItem("user", new DateTime(), A.Fake <ICommand>())
            {
                Id = "id"
            };
            _existingMetaDataItem = new HistoryItemMetaData {
                User = _existingItem.User, Id = "id", Command = new CommandMetaData {
                    Comment = "there"
                }
            };
            _existingItem.Command.Comment = "hi";
            _history = new List <IHistoryItem>
            {
                _existingItem
            };

            _existingHistoryItemMetaData = new List <HistoryItemMetaData>
            {
                _existingMetaDataItem
            };

            _historyManager = A.Fake <IHistoryManager>();

            A.CallTo(() => _historyManager.History).Returns(_history);
            A.CallTo(() => _historyItemMetaDataRepository.All(A <ISession> ._)).Returns(_existingHistoryItemMetaData);
            A.CallTo(() => _historyItemToHistoryItemMetaDataMapper.MapFrom(_existingItem)).Returns(_existingMetaDataItem);
        }
 protected override void Context()
 {
     base.Context();
     _session             = A.Fake <ISession>();
     _historyItemMetaData = new HistoryItemMetaData {
         Command = new CommandMetaData()
     };
 }
        protected override void Context()
        {
            base.Context();
            _session = A.Fake <ISession>();

            _historyItemMetaData = new HistoryItemMetaData {
                Id = "historyItemId"
            };

            A.CallTo(() => _session.Get <HistoryItemMetaData>("historyItemId")).Returns(null);
        }
Exemple #4
0
        public IHistoryItem MapFrom(HistoryItemMetaData historyItemMetaData)
        {
            IHistoryItem historyItem = new HistoryItem(
                historyItemMetaData.User,
                historyItemMetaData.DateTime,
                _commandMapper.MapFrom(historyItemMetaData.Command));

            historyItem.State = historyItemMetaData.State;
            historyItem.Id    = historyItemMetaData.Id;
            return(historyItem);
        }
Exemple #5
0
        public void Save(HistoryItemMetaData historyItemMetaData, ISession session)
        {
            var existingItem = session.Get <HistoryItemMetaData>(historyItemMetaData.Id);

            //already exists nothng to do to
            if (existingItem != null)
            {
                return;
            }

            session.Save(historyItemMetaData);
            SaveCommand(historyItemMetaData, session);
        }
Exemple #6
0
        protected override void Context()
        {
            base.Context();
            _existingItem         = new HistoryItem("user", new DateTime(), A.Fake <ICommand>());
            _existingMetaDataItem = new HistoryItemMetaData {
                User = _existingItem.User
            };
            _history = new List <IHistoryItem>
            {
                _existingItem
            };
            _historyManager = A.Fake <IHistoryManager>();

            A.CallTo(() => _historyManager.History).Returns(_history);
            A.CallTo(() => _historyItemToHistoryItemMetaDataMapper.MapFrom(_existingItem)).Returns(_existingMetaDataItem);
        }
Exemple #7
0
 public void SaveCommand(HistoryItemMetaData historyItemMetaData, ISession session)
 {
     _commandMetaDataRepository.Save(historyItemMetaData.Command, session);
 }