コード例 #1
0
        public ProblemServiceTest()
        {
            _conn = new DbConnexion("Test_LittleProblem");
            _problemCollection = _conn.Collection<Problem>(CollectionNames.Problem);
            _problemService = new ProblemService(_conn);

            // Perform factory set up (once for entire test run)
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => c.UseDefaultConventions());
                x.AddFromAssemblyContainingType<Member>();

                x.Include<Member>()
                    .Setup(m => m.Id).Use<ObjectIdDataSource>()
                    .Setup(m => m.OpenId).Random(5, 10)
                    .Setup(m => m.UserName).Random(5, 7);

                x.Include<Problem>()
                    .Setup(p => p.Id).Use<ObjectIdDataSource>()
                    .Setup(p => p.Text).Use<LoremIpsumSource>()
                    .Setup(p => p.Title).Random(7, 12);

                x.Include<Response>()
                    .Setup(r => r.Text).Use<LoremIpsumSource>();
            });

            // Generate one of these per test (factory will be a static variable most likely)
            _session = factory.CreateSession();
        }
コード例 #2
0
 public ConnexionMenuViewModel(IEventAggregator eventAggregator, IConnexion connexion, IInformationService service)
 {
     _eventAggregator = eventAggregator;
     _connexion       = connexion;
     _service         = service;
     Connexion        = new DelegateCommand(Connect);
 }
コード例 #3
0
        public ProblemServiceTest()
        {
            _conn = new DbConnexion("Test_LittleProblem");
            _problemCollection = _conn.Collection <Problem>(CollectionNames.Problem);
            _problemService    = new ProblemService(_conn);

            // Perform factory set up (once for entire test run)
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => c.UseDefaultConventions());
                x.AddFromAssemblyContainingType <Member>();

                x.Include <Member>()
                .Setup(m => m.Id).Use <ObjectIdDataSource>()
                .Setup(m => m.OpenId).Random(5, 10)
                .Setup(m => m.UserName).Random(5, 7);

                x.Include <Problem>()
                .Setup(p => p.Id).Use <ObjectIdDataSource>()
                .Setup(p => p.Text).Use <LoremIpsumSource>()
                .Setup(p => p.Title).Random(7, 12);

                x.Include <Response>()
                .Setup(r => r.Text).Use <LoremIpsumSource>();
            });

            // Generate one of these per test (factory will be a static variable most likely)
            _session = factory.CreateSession();
        }
コード例 #4
0
 public MainRegionController(IRegionManager regionManager,
                             IEventAggregator eventAggregator,
                             IUnityContainer container,
                             IGameModeInfoService service,
                             IConnexion connexion)
 {
     if (regionManager == null)
     {
         throw new ArgumentNullException("regionManager");
     }
     if (eventAggregator == null)
     {
         throw new ArgumentNullException("eventAggregator");
     }
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     if (service == null)
     {
         throw new ArgumentNullException("service");
     }
     if (connexion == null)
     {
         throw new ArgumentNullException("connexion");
     }
     this._container        = container;
     this._regionManager    = regionManager;
     this._eventAggregator  = eventAggregator;
     this._service          = service;
     _connexion             = connexion;
     _connexion.ErrorGames += ErrorGames;
     this._eventAggregator.GetEvent <GameModeSelectedEvent>().Subscribe(GameModeSelected, true);
     this._eventAggregator.GetEvent <ChangeViewMainRegionEvent>().Subscribe(ChangeViewMain, true);
 }
コード例 #5
0
        public CurrentGameModes GetDetails(IConnexion connexion)
        {
            List <CurrentGameMode> currentGameMode  = connexion.GetGames();
            CurrentGameModes       currentGameModes = new CurrentGameModes();

            currentGameModes.AddRange(currentGameMode);
            return(currentGameModes);
        }
コード例 #6
0
        public PlayersInGame GetPlayers(IConnexion connexion, int idGame)
        {
            List <Player> players = connexion.GetPlayerInGame(idGame);

            _players.AddRange(players);

            return(_players);
        }
コード例 #7
0
ファイル: ClienteGT.cs プロジェクト: pichiliani/CoMusic
 private void client_ConnexionRemoved(Communicator c, IConnexion conn)
 {
     /* if (!IsDisposed && client.Connexions.Count == 0)
     {
         MessageBox.Show(this, "Disconnected from server", Text);
         Close();
     } */
 }
コード例 #8
0
 public CreateModeMenuViewModel(IGameModeInfoService gameModeInfoService, IInformationService service, IEventAggregator eventAggregator, IConnexion connexion)
 {
     _eventAggregator = eventAggregator;
     Return           = new DelegateCommand(ReturnMainMenu);
     Create           = new DelegateCommand(CreateMode);
     _connexion       = connexion;
     GameModeInfos    = new ListCollectionView(gameModeInfoService.GetGameModeInfos());
     this.GameModeInfos.CurrentChanged += new EventHandler(SelectedGameInfoChanged);
     _service = service;
 }
コード例 #9
0
 public AttenteMenuViewModel(IEventAggregator eventAggregator, IInformationService serviceInfo, IConnexion connexion, IPlayersInGameService servicePlayer)
 {
     _eventAggregator         = eventAggregator;
     _connexion               = connexion;
     _servicePlayer           = servicePlayer;
     _serviceInfo             = serviceInfo;
     Players                  = new ListCollectionView(servicePlayer.GetPlayers(connexion, serviceInfo.GetCurrentGameMode().Id));
     _connexion.NewPlayer    += RefreshPlayers;
     _connexion.DeletePLayer += DeletePlayer;
     _connexion.StartGame    += Start;
 }
コード例 #10
0
 public JoinModeMenuViewModel(ICurrentGameModeService currentGameModeService, IInformationService service, IEventAggregator eventAggregator, IConnexion connexion)
 {
     _eventAggregator = eventAggregator;
     CurrentGameModes = new ListCollectionView(currentGameModeService.GetDetails(connexion));
     CurrentGameModes.CurrentChanged += new EventHandler(SelectedGameInfoChanged);
     _gameModeService = currentGameModeService;
     Return           = new DelegateCommand(ReturnMainMenu);
     Join             = new DelegateCommand(JoinGame);
     _connexion       = connexion;
     _service         = service;
     StartTimer();
 }
コード例 #11
0
ファイル: Server.cs プロジェクト: briandealwis/gt
 private void _server_ObjectReceived(Message m, IConnexion client, ITransport transport)
 {
     if (m is ObjectMessage)
     {
         object obj = ((ObjectMessage) m).Object;
         if (obj is PositionChanged)
         {
             if(PositionUpdates != null)
             {
                 PositionUpdates(((PositionChanged) obj).X, ((PositionChanged) obj).Y);
             }
         }
     }
 }
コード例 #12
0
 public MainViewViewModel(IGridCellService gridCell, IConnexion connexion, IInformationService informationService, IZoneService zoneService)
 {
     ButtonClic          = true;
     Scale               = 1;
     _gridCell           = gridCell;
     MousePressedCommand = new DelegateCommand <MouseButtonEventArgs>(MousePressed);
     MouseWheelCommand   = new DelegateCommand <MouseWheelEventArgs>(MouseWheel);
     MouseMoveCommand    = new DelegateCommand <MouseEventArgs>(MouseMove);
     RightDownCommand    = new DelegateCommand <MouseButtonEventArgs>(RightDown);
     RightUpCommand      = new DelegateCommand <MouseButtonEventArgs>(RightUp);
     StartPressedCommand = new DelegateCommand(StartPressed);
     _connexion          = connexion;
     _informationService = informationService;
     _zoneService        = zoneService;
     Zone = new Zone();
     _connexion.SwitchCell += SwitchCell;
     _connexion.StartGenEv += StartGen;
     _timer.Elapsed        += GetGen;
 }
コード例 #13
0
ファイル: Server.cs プロジェクト: briandealwis/gt
 protected override void AddConnexion(IConnexion cnx)
 {
     base.AddConnexion(cnx);
     newlyAddedClients.Add(cnx); // used for ClientsJoined event
     clientIDs.Add(cnx.Identity, cnx);
 }
コード例 #14
0
 public MembershipService(IConnexion connexion)
 {
     _connexion = connexion;
     _membersCollection = _connexion.Collection<Member>(CollectionNames.Member);
 }
コード例 #15
0
 public MemberRepository(IConnexion conn)
 {
     _connexion = conn;
     _membersCollection = _connexion.Collection<Member>(CollectionNames.Member);
 }
コード例 #16
0
ファイル: NetExceptions.cs プロジェクト: briandealwis/gt
 public CannotSendMessagesError(IConnexion source, Exception ex, ICollection<Message> msgs)
     : this(source)
 {
     AddAll(ex, msgs);
 }
コード例 #17
0
 public DataDetailsTransport(IConnexion connexion)
 {
     connectApi = connexion;
 }
コード例 #18
0
 public ProblemService(IConnexion connexion)
 {
     _connexion = connexion;
     _problemsCollection = _connexion.Collection<Problem>(CollectionNames.Problem);
 }
コード例 #19
0
ファイル: Client.cs プロジェクト: briandealwis/gt
 private void _cnx_TransportAdded(IConnexion cnx, ITransport transport)
 {
     if(transport is NetworkEmulatorTransport)
     {
         ((NetworkEmulatorTransport) transport).PacketDisposition +=
             _transport_PacketDisposed;
     }
     UpdateTransport(transport);
 }
コード例 #20
0
ファイル: Client.cs プロジェクト: briandealwis/gt
 private void _client_ConnexionAdded(Communicator c, IConnexion cnx)
 {
     cnx.TransportAdded += _cnx_TransportAdded;
     foreach (ITransport t in cnx.Transports)
     {
         _cnx_TransportAdded(cnx, t);
     }
 }
コード例 #21
0
 public MembershipService(IConnexion connexion)
 {
     _connexion         = connexion;
     _membersCollection = _connexion.Collection <Member>(CollectionNames.Member);
 }
コード例 #22
0
 public MemberRepository(IConnexion conn)
 {
     _connexion         = conn;
     _membersCollection = _connexion.Collection <Member>(CollectionNames.Member);
 }
コード例 #23
0
 public Unduplicate(IConnexion co)
 {
     this.connexion = co;
 }
コード例 #24
0
 public ProblemService(IConnexion connexion)
 {
     _connexion          = connexion;
     _problemsCollection = _connexion.Collection <Problem>(CollectionNames.Problem);
 }
コード例 #25
0
 public ProblemRepository(IConnexion conn)
 {
     _connexion = conn;
     _problemsCollection = _connexion.Collection<Problem>(CollectionNames.Problem);
 }
コード例 #26
0
        public AbstractPacketScheduler(IConnexion cnx)
        {
            log = LogManager.GetLogger(GetType());

            this.cnx = cnx;
        }
コード例 #27
0
ファイル: NetExceptions.cs プロジェクト: briandealwis/gt
 public NoMatchingTransport(IConnexion connexion, MessageDeliveryRequirements mdr,
     ChannelDeliveryRequirements cdr)
     : base(Severity.Warning, String.Format("Could not find capable transport (mdr={0}, cdr={1})", mdr, cdr))
 {
     SourceComponent = connexion;
     this.mdr = mdr;
     this.cdr = cdr;
 }
コード例 #28
0
ファイル: NetExceptions.cs プロジェクト: briandealwis/gt
 public CannotSendMessagesError(IConnexion source, Exception ex, PendingMessage msg)
     : this(source)
 {
     Add(ex, msg);
 }
コード例 #29
0
ファイル: NetExceptions.cs プロジェクト: briandealwis/gt
 public ConnexionClosedException(IConnexion connexion)
     : base(Severity.Warning)
 {
     SourceComponent = connexion;
 }
コード例 #30
0
 //constructeur
 public Unduplicate(IConnexion con)
 {
     Connect = con;
 }
コード例 #31
0
ファイル: NetExceptions.cs プロジェクト: briandealwis/gt
 public CannotSendMessagesError(IConnexion source)
     : base(Severity.Warning)
 {
     SourceComponent = source;
 }
コード例 #32
0
ファイル: Program.cs プロジェクト: pichiliani/CoMusic
 private void s_MessageReceived(Message m, IConnexion client, ITransport transport)
 {
     if (Verbose > 2 && log.IsInfoEnabled)
     {
         log.Info(String.Format("received message: {0} from Client {1} via {2}",
                                 m, client.Identity, transport));
     }
     //repeat whatever we receive to everyone else
     server.Send(m, null, new MessageDeliveryRequirements(transport.Reliability,
         MessageAggregation.Immediate, transport.Ordering));
 }
コード例 #33
0
 public RoundRobinPacketScheduler(IConnexion cnx)
     : base(cnx)
 {
 }
コード例 #34
0
 //constructeur
 public DataDetailsTransport(IConnexion conn)
 {
     Connect = conn;
 }
コード例 #35
0
 public ImmediatePacketScheduler(IConnexion cnx)
     : base(cnx)
 {
 }
コード例 #36
0
 public Zone InitializeZone(IConnexion connexion, int idGame)
 {
     _zone = new Zone();
     _zone.AddRange(connexion.GetZone(idGame));
     return(_zone);
 }
コード例 #37
0
 public ProblemRepository(IConnexion conn)
 {
     _connexion          = conn;
     _problemsCollection = _connexion.Collection <Problem>(CollectionNames.Problem);
 }
コード例 #38
0
ファイル: Utils.cs プロジェクト: pichiliani/CoMusic
 private void _cnx_TransportAdded(IConnexion connexion, ITransport transport)
 {
     timers[transport] = Stopwatch.StartNew();
 }
コード例 #39
0
ファイル: Program.cs プロジェクト: pichiliani/CoMusic
 private void _client_TransportRemoved(IConnexion client, ITransport newTransport)
 {
     if (Verbose > 1 && log.IsInfoEnabled)
     {
         log.Info(String.Format("Client {0}: transport removed: {1}",
                                client.Identity, newTransport));
     }
 }
コード例 #40
0
ファイル: Utils.cs プロジェクト: pichiliani/CoMusic
 private void _cnx_TransportRemoved(IConnexion connexion, ITransport transport)
 {
     timers.Remove(transport);
 }
コード例 #41
0
ファイル: ClienteGT.cs プロジェクト: pichiliani/CoMusic
 private void MensagemEnviada(GT.Net.Message a, IConnexion b, ITransport c)
 {
     if ((a.MessageType.Equals(MessageType.Object)) && (a.ChannelId.Equals(2)))
     {
         ContaEnviadas++;
         // this.label1.Text = "Enviadas:" + ContaEnviadas.ToString() + " de:" + coords.Identity.ToString();
     }
 }
コード例 #42
0
ファイル: Utils.cs プロジェクト: pichiliani/CoMusic
 private void _comm_ConnexionAdded(Communicator c, IConnexion cnx)
 {
     cnx.TransportAdded += _cnx_TransportAdded;
     cnx.TransportRemoved += _cnx_TransportRemoved;
     cnx.PingRequested += _cnx_PingRequested;
     cnx.PingReplied += _cnx_PingReceived;
     foreach(ITransport t in cnx.Transports)
     {
         _cnx_TransportAdded(cnx, t);
     }
 }
コード例 #43
0
ファイル: PingClient.cs プロジェクト: briandealwis/gt
 private void _client_ConnexionAdded(Communicator c, IConnexion cnx)
 {
     cnx.PingRequested += _cnx_PingRequested;
     cnx.PingReplied += _cnx_PingReceived;
 }
コード例 #44
0
ファイル: Utils.cs プロジェクト: pichiliani/CoMusic
 private void _comm_ConnexionRemoved(Communicator c, IConnexion conn)
 {
     conn.PingRequested -= _cnx_PingRequested;
     conn.PingReplied -= _cnx_PingReceived;
 }
コード例 #45
0
ファイル: Server.cs プロジェクト: briandealwis/gt
 protected override void RemovedConnexion(IConnexion cnx)
 {
     clientIDs.Remove(cnx.Identity);
     if (ClientsRemoved != null)
     {
         ClientsRemoved(new SingleItem<IConnexion>(cnx));
     }
     base.RemovedConnexion(cnx);
 }
コード例 #46
0
ファイル: StressTests.cs プロジェクト: briandealwis/gt
        private void server_MessageReceived(Message m, IConnexion client, ITransport transport)
        {
            switch (m.MessageType)
            {
            case MessageType.Binary:
                if (!ByteUtils.Compare(((BinaryMessage) m).Bytes, StandardObjects.ByteMessage))
                {
                    Console.WriteLine("Invalid byte message: {0}",
                        ByteUtils.DumpBytes(((BinaryMessage) m).Bytes));
                    errorOccurred = true;
                }
                break;
            case MessageType.String:
                if (!StandardObjects.StringMessage.Equals(((StringMessage) m).Text))
                {
                    Console.WriteLine("Invalid strings message: {0}",
                        ((StringMessage) m).Text);
                    errorOccurred = true;
                }
                break;

            case MessageType.Object:
                if (!StandardObjects.Equivalent(StandardObjects.ObjectMessage, ((ObjectMessage) m).Object))
                {
                    Console.WriteLine("Invalid object message: {0}",
                        ((ObjectMessage) m).Object);
                    errorOccurred = true;
                }
                break;
            }

            // Randomly send a message elsewhere 10% of the time;
            // this has multiple senders from outside of the server's listening loop
            if (random.Next(0, 100) < 10)
            {
                return;
            }

            int clientNumber = random.Next(0, Server.Clients.Count - 1);
            server_SendMessage(m, clientNumber);
        }