コード例 #1
0
        /// <summary>
        /// Converts IQueryable<see cref="RepositoryOperation"/> to <see cref="PreviewModel"/> object
        /// </summary>
        /// <Returns><see cref="PreviewModel"/> object</Returns>
        public PreviewModel GetModel()
        {
            _model = new PreviewModel();

            foreach (var item in _repository)
            {
                _model.AddDaySpanOperation(item.Year,item.Month,item.Day,new SingleOperation{OperationName = item.OperationName, Value = item.OperationValue,Id = item.ID});
            }
            return _model;
        }
コード例 #2
0
 private Mock<IOperationRepository> CreateRepository()
 {
     Mock<IOperationRepository> mock = new Mock<IOperationRepository>();
     var model = new PreviewModel();
     model.AddDaySpanOperation(2012,1,1,new SingleOperation{Id = 0,OperationName = "Novus", Value = 40});
     model.AddDaySpanOperation(2012,1,1,new SingleOperation{Id = 1,OperationName = "MacDonalds", Value = 40});
     model.AddDaySpanOperation(2012,1,5,new SingleOperation{Id = 2,OperationName = "Mouse", Value = 40});
     model.AddDaySpanOperation(2012, 2, 1, new SingleOperation { Id = 3, OperationName = "MacDonalds", Value = 40 });
     model.AddDaySpanOperation(2012, 2, 5, new SingleOperation { Id = 4, OperationName = "Mouse", Value = 40 });
     model.SetCurrentMonth(1, 2012);
     mock.Setup(x => x.Model(It.IsAny<int>())).Returns(model);
     return mock;
 }