Example #1
0
 public void InIt()
 {
     _stubModel             = MockRepository.GenerateStub <IModel>();
     _stubModel.Id          = _teamid;
     _stubModel.Id          = _matchid;
     _stubPersistentService = MockRepository.GenerateStub <IPersistentService>();
     _target = new IVFManager(_stubPersistentService);
 }
Example #2
0
        public ModuleService(IPersistentService persistentService, string pathToModuleDirectory)
        {
            _persistentService     = persistentService;
            _pathToModuleDirectory = pathToModuleDirectory;

            _registeredModules = new List <IOrganizerModule>();

            StartWatchDirectory();
        }
Example #3
0
        public static void Add <TEntity>(this IPersistentService persistentService, TEntity entity)
            where TEntity : class, IEntity, new()
        {
            CheckHelper.ArgumentNotNull(persistentService, "persistentService");
            CheckHelper.ArgumentNotNull(entity, "entity");

            persistentService
            .GetEntitySet <TEntity>()
            .Add(entity);
        }
Example #4
0
        public static TEntity GetEntityById <TEntity>(this IPersistentService persistentService, int id)
            where TEntity : class, IEntity, new()
        {
            CheckHelper.ArgumentNotNull(persistentService, "persistentService");
            CheckHelper.ArgumentWithinCondition(id > 0, "id > 0");

            return
                (persistentService
                 .GetEntitySet <TEntity>()
                 .SingleOrDefault(e => e.Id == id));
        }
Example #5
0
        public PersistentActor(IPersistentService <T> service, string actorName) : base()
        {
            var act = DirectoryActor.GetDirectory().GetActorByName(actorName);

            if (act == null)
            {
                DirectoryActor.GetDirectory().Register(this, actorName);
            }
            Become(new PersistentLoadBehavior <T>(service));
            AddBehavior(new PersistentWriteBehavior <T>(service));
            AddBehavior(new Behavior <IEventSource <T> >(Transact));
            AddBehavior(new Behavior <PersistentCommand, IActor>(
                            (c, a) => c == PersistentCommand.GetCurrent,
                            (c, a) => a.SendMessage(fCurrentState)));
        }
        public void InIt()
        {
            _id              = Guid.NewGuid();
            _stubModel       = MockRepository.GenerateStub <IModel>();
            _stubTeamPlayers = MockRepository.GenerateStub <TeamPlayers>();
            _stubDtoPlayer   = MockRepository.GenerateStub <PlayerDTO>();
            _stubPlayer      = MockRepository.GenerateStub <Player>();

            _stubSerializer        = MockRepository.GenerateStub <ISerializer>();
            _stubLinqService       = MockRepository.GenerateStub <ILinqService>();
            _stubRemoteFile        = MockRepository.GenerateStub <IRemoteFile>();
            _stubPersistentService = MockRepository.GenerateStub <IPersistentService>();
            _target = new PersistentService(_stubSerializer,
                                            _stubLinqService, _stubRemoteFile);
        }
        private static void SetIds <TEntity>(IPersistentService persistentService)
            where TEntity : class, IEntity, new()
        {
            var entities    = persistentService.GetEntitySet <TEntity>().ToArray();
            var newEntities = entities.Where(e => e.IsNew()).ToArray();

            if (newEntities.Any())
            {
                var maxId = entities.Max(e => e.Id);

                foreach (var newEntity in newEntities)
                {
                    newEntity.Id = ++maxId;
                }
            }
        }
        private static void SaveChanges(IPersistentService persistentService)
        {
            SetIds <User>(persistentService);
            SetIds <Role>(persistentService);
            SetIds <UserRole>(persistentService);
            SetIds <DataAccess.Category>(persistentService);
            SetIds <SubCategory>(persistentService);
            SetIds <DataAccess.Brand>(persistentService);
            SetIds <DataAccess.Size>(persistentService);
            SetIds <DataAccess.ActionLog>(persistentService);
            SetIds <ActionLogType>(persistentService);
            SetIds <DataAccess.Product>(persistentService);
            SetIds <DataAccess.ProductSize>(persistentService);
            SetIds <DataAccess.Settings>(persistentService);
            SetIds <DataAccess.Parcel>(persistentService);
            SetIds <DataAccess.Order>(persistentService);
            SetIds <OrderItem>(persistentService);
            SetIds <DataAccess.DistributorTransfer>(persistentService);

            MockDataInitializer.InitializeCollections();
        }
Example #9
0
        public static IQueryable <TActivatedEntity> GetActiveEntities <TActivatedEntity>(this IPersistentService persistentService)
            where TActivatedEntity : class, IEntity, IActivatedEntity, new()
        {
            CheckHelper.ArgumentNotNull(persistentService, "persistentService");

            return
                (persistentService
                 .GetEntitySet <TActivatedEntity>()
                 .Where(e => e.Active));
        }
        public void InIt()
        {
            _id = Guid.NewGuid();
            _stubModel = MockRepository.GenerateStub<IModel>();
            _stubTeamPlayers = MockRepository.GenerateStub<TeamPlayers>();
            _stubDtoPlayer = MockRepository.GenerateStub<PlayerDTO>();
            _stubPlayer = MockRepository.GenerateStub<Player>();

            _stubSerializer = MockRepository.GenerateStub<ISerializer>();
            _stubLinqService = MockRepository.GenerateStub<ILinqService>();
            _stubRemoteFile = MockRepository.GenerateStub<IRemoteFile>();
            _stubPersistentService = MockRepository.GenerateStub<IPersistentService>();
            _target = new PersistentService(_stubSerializer,
                _stubLinqService,_stubRemoteFile);
        }
 public PersistentLoadBehavior(IPersistentService <T> service) : base()
 {
     fService = service;
     Apply    = DoApply;
     Pattern  = DoPattern;
 }
Example #12
0
 public ImageManager(IPersistentService persistentService, IFileSystem fileSystem)
 {
     _persistenService = persistentService;
     _filesystem       = fileSystem;
 }
Example #13
0
 public IVFManager(IPersistentService persistentService)
 {
     _persistentService = persistentService;
 }
Example #14
0
 public Statist(IPersistentService persistentService)
 {
     _persistentService = persistentService;
 }
Example #15
0
 public void InIt()
 {
     _stubModel = MockRepository.GenerateStub<IModel>();
     _stubModel.Id = _teamid;
     _stubModel.Id = _matchid;
     _stubPersistentService = MockRepository.GenerateStub<IPersistentService>();
     _target = new IVFManager(_stubPersistentService);
 }
Example #16
0
 public Statist(IPersistentService persistentService)
 {
     _persistentService = persistentService;
 }
Example #17
0
 public IVFManager(IPersistentService persistentService)
 {
     _persistentService = persistentService;
 }
 public PersistentWriteBehavior(IPersistentService <T> service) : base()
 {
     _service = service;
     Apply    = DoApply;
     Pattern  = DoPattern;
 }