Beispiel #1
0
        public static MatchResponse GetDominectMatch(GameCom.GameComClient client, uint width, uint height, string userToken)
        {
            var cancellationToken = new System.Threading.CancellationToken();

            cancellationToken.Register(() => Console.WriteLine("Request cancelled!"));
            var mmParam = new MatchmakingParameter();

            mmParam.RandomIsDefault = new Nothing();

            var request = new MatchRequest()
            {
                UserToken                = userToken,
                GameToken                = "dom",
                MatchmakingParameters    = mmParam,
                TimeoutSuggestionSeconds = 400,
                DomGameParameters        = new GameParameter()
                {
                    BoardWidth  = width,
                    BoardHeight = height
                }
            };

            var reply = client.NewMatch(request, null, DateTime.UtcNow.AddMinutes(1d), cancellationToken);

            return(reply);
        }
Beispiel #2
0
        public void MatchRequest_Url()
        {
            var r = new MatchRequest
            {
                Coordinates = matchLocations,
                Timestamps  = new int[] { 1424684612, 1424684616, 142468462 }
            };

            // Default values are not sent
            //Assert.AreEqual<int>(1, ParamValues(r.UrlParams, "steps").Length);
            //Assert.AreEqual<string>("false", ParamValues(r.UrlParams, "steps")[0]);

            //Assert.AreEqual<int>(1, ParamValues(r.UrlParams, "geometries").Length);
            //Assert.AreEqual<string>("polyline", ParamValues(r.UrlParams, "geometries")[0]);

            //Assert.AreEqual<int>(1, ParamValues(r.UrlParams, "overview").Length);
            //Assert.AreEqual<string>("simplified", ParamValues(r.UrlParams, "overview")[0]);

            Assert.IsTrue(r.CoordinatesUrlPart.Contains("13.393252,52.542648"));
            Assert.IsTrue(r.CoordinatesUrlPart.Contains("13.394780,52.543079"));
            Assert.IsTrue(r.CoordinatesUrlPart.Contains("13.397389,52.542107"));

            var tParams = ParamValues(r.UrlParams, "timestamps");

            Assert.AreEqual <int>(1, tParams.Length);
            Assert.IsTrue(tParams[0].Contains("1424684612"));
            Assert.IsTrue(tParams[0].Contains("1424684616"));
            Assert.IsTrue(tParams[0].Contains("142468462"));
        }
Beispiel #3
0
 /// <summary>
 /// Zwiększa "wagę" słowa wybranego z propozycji fraz.
 /// </summary>
 public void Match(MatchRequest request)
 {
     using (var ctx = new TypeFineContext())
     {
         SaveInfo(request, ctx, RequestType.Match);
         KeywordPhraseReference reference;
         try
         {
             reference = ctx.KeywordPhraseReferences.Include(x => x.Keyword).Include(x => x.Phrase).Single(x =>
                                                                                                           x.Keyword.Value == request.Keyword &&
                                                                                                           x.Phrase.Value == request.Phrase);
         }
         catch (Exception)
         {
             throw new FaultException("nie znaleziono złączenia pomiędzy podanym słowem kluczowym i frazą", new FaultCode("Match"));
         }
         reference.UserWeight += 0.02;
         if (reference.CompositeConvergance > 1)
         {
             reference.Keyword.Phrase = reference.Phrase;
             var toRemove = reference.Keyword.WeakReferences.ToList();
             ctx.KeywordPhraseReferences.RemoveRange(toRemove);
             ctx.SaveChanges();
         }
         ctx.SaveChanges();
     }
 }
Beispiel #4
0
        public async Task ShouldGetAMatchesBeOkHavingElements()
        {
            var existing = Scenario.Matches.FirstOrDefault();

            if (existing == null)
            {
                Assert.Inconclusive("No match found");
                return;
            }
            var groups = Scenario.Groups.Where(x => x.MatchId == existing.Id).Select(x => x.Id).ToList();

            var shooterGroups = Scenario.GroupShooters.Where(x => groups.Contains(x.GroupId)).ToList();

            if (shooterGroups.Count == 0)
            {
                Assert.Inconclusive("No shooter in group");
                return;
            }

            //conteggio esistenti generici o inseriti dall'utente
            var request = new MatchRequest
            {
                MatchId = existing.Id
            };

            //Invoke del metodo
            var response = await Controller.GetMatch(request);

            //Parsing della risposta e assert
            var parsed = ParseExpectedOk <MatchContract>(response);

            Assert.IsTrue(parsed.Data.Groups.SelectMany(x => x.Shooters).Any());
        }
        private MatchResult GetExistsIIIds(object[] iiidsFilter)
        {
            if (iiidsFilter == null || iiidsFilter.Length == 0)
            {
                return(null);
            }
            var searchService = GetService <ISearchService>();
            var matchRequest  = new MatchRequest();

            matchRequest.Top = 10;
            var dataMatchFilter = new Dictionary <string, object[]>();

            dataMatchFilter.Add("iiid", iiidsFilter);
            matchRequest.Filter = dataMatchFilter;
            var dataMatchSort = new List <PKSKeyValuePair <string, object> >();

            dataMatchSort.Add(new PKSKeyValuePair <string, object>("iiid", 1));
            matchRequest.Sort = dataMatchSort;
            var fieldFilter = new SearchSourceFilter();

            fieldFilter.Includes = new List <string> {
                "iiid", "dataid"
            };
            matchRequest.Fields = fieldFilter;
            return(searchService.Match(matchRequest));
        }
        public async Task <ActionResult> UpdateMatch(int id, [FromBody] MatchRequest matchRequest)
        {
            if (id < 1 || matchRequest == null)
            {
                return(BadRequest());
            }

            var matchToUpdate = await this.matchService.FindAsync(id);

            if (matchToUpdate == null)
            {
                return(NotFound());
            }

            var match = this.mapper.Map(matchRequest, matchToUpdate);

            if (!validator.Validate(match).IsValid)
            {
                return(BadRequest());
            }

            await this.matchService.UpdateAsync(match);

            logger.LogInformation($"UpdateMatch {match.Id}");

            return(Ok());
        }
        public void CreateWithMatchmakerUI(MatchRequest request, IRealTimeMultiplayerListener listener)
        {
            Util.NullArgumentTest(request);
            Util.NullArgumentTest(listener);

            if (mCurrentMatchmakerVC != null)
            {
                Debug.Log("Ignoring CreateWithMatchmakerUI call because another matchmaker UI is being shown.");
                return;
            }

            // Create a new GKMatchmakerViewController.
            var vc = InteropObjectFactory <GKMatchmakerViewController> .Create(
                () =>
            {
                using (var gkReq = request.ToGKMatchRequest())
                    return(new GKMatchmakerViewController(gkReq));
            },
                viewController =>
            {
                return(viewController.ToPointer());
            });

            // Create a delgate for the vc.
            vc.MatchmakerDelegate = new InternalGKMatchmakerViewControllerDelegateImpl(this, listener);

            // Store the VC ref.
            mCurrentMatchmakerVC = vc;

            // Now show the VC.
            using (var unityVC = UIViewController.UnityGetGLViewController())
                unityVC.PresentViewController(vc, true, null);
        }
Beispiel #8
0
        public Task <Match> UpdateAsync(int id, MatchRequest request)
        {
            return(CommonOperationAsync(async() =>
            {
                var result = await GetByIdAsync(id);
                Mapper.Map(request, result);

                /**************MatchDate And Order are unique*****************/
                /*************************************************************/
                var matchDateAndOrderUniqueResult =
                    await _uow.Matches.GetByMatchDateAndOrderAsync(result.MatchDate, result.Order);

                matchDateAndOrderUniqueResult.CheckUniqueValueForUpdate(result.Id, WebApiResourceConstants.MatchDateAndOrder);
                /**************MatchDate And Order are unique*****************/
                /*************************************************************/

                SameValueCheckForTeam1AndTeam2(result);

                _uow.Matches.Update(result, GetLoggedInUserId());
                await _uow.SaveChangesAsync();

                return result;
            }, new BusinessBaseRequest()
            {
                MethodBase = MethodBase.GetCurrentMethod()
            }));
        }
    public static void RespondToRequest(RpsAgent victim, RpsAgent initiator, bool accepted)
    {
        int requestIndex = instance.requests.FindIndex(r => r.victim == victim && r.initiator == initiator);

        if (requestIndex < 0)
        {
            Debug.Log("Server: " + victim.AgentName + " tried responding to a match that does not exist.");
            // TODO: Notify victim.
            return;
        }
        else
        {
            MatchRequest request = instance.requests[requestIndex];
            if (accepted)
            {
                // Spawn new match.
                Debug.Log("Server: Match created between " + initiator.AgentName + " and " + victim.AgentName);
                RpsMatch match = GameObject.Instantiate <RpsMatch>(instance.RpsMatchPrefab);
                match.Initialize(request.initiator, request.victim);
                match.transform.SetParent(instance.transform);
                instance.ongoingMatches.Add(match);
                NetworkServer.Spawn(match.gameObject);
            }
            else
            {
                // Tell initiator that the victim declined.
            }
            instance.requests.RemoveAt(requestIndex);
        }
    }
Beispiel #10
0
        public void Should_Return_Weighted_Scores_Based_On_Queued_Time()
        {
            var now = DateTime.Now;

            var player1 = new[] { new Player("bob") };
            var player2 = new[] { new Player("sue") };
            var player3 = new[] { new Player("jerry") };

            var request1QueuedOn = now - TimeSpan.FromSeconds(2.75);
            var request1         = new MatchRequest(player1, new [] { GameTitle.HaloReach }, new [] { GameMode.Slayer, GameMode.Swat }, request1QueuedOn);

            var request2QueuedOn = now - TimeSpan.FromSeconds(6);
            var request2         = new MatchRequest(player2, new [] { GameTitle.HaloReach, GameTitle.Halo2 }, new [] { GameMode.Slayer, GameMode.Snipers }, request2QueuedOn);

            var request3QueuedOn = now - TimeSpan.FromSeconds(14);
            var request3         = new MatchRequest(player3, new [] { GameTitle.HaloReach }, new [] { GameMode.AssetDenial, GameMode.ActionSack }, request3QueuedOn);

            var scores = _sut.GetScores(new[] { request1, request2, request3 });

            Assert.Equal(7, scores.Count);
            Assert.Equal(3, scores[new Preference(GameTitle.HaloReach, GameMode.Slayer)]);
            Assert.Equal(1, scores[new Preference(GameTitle.HaloReach, GameMode.Swat)]);
            Assert.Equal(2, scores[new Preference(GameTitle.HaloReach, GameMode.Snipers)]);
            Assert.Equal(2, scores[new Preference(GameTitle.Halo2, GameMode.Slayer)]);
            Assert.Equal(2, scores[new Preference(GameTitle.Halo2, GameMode.Snipers)]);
            Assert.Equal(3, scores[new Preference(GameTitle.HaloReach, GameMode.AssetDenial)]);
            Assert.Equal(3, scores[new Preference(GameTitle.HaloReach, GameMode.ActionSack)]);
        }
Beispiel #11
0
        public async Task <IActionResult> PutMatch(int id, MatchRequest match)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            // _context.Entry(match).State = EntityState.Modified;

            try
            {
                var responce = await _service.UpdateMatchAsync(match, id);

                if (responce == null)
                {
                    return(BadRequest(ModelState));
                }
                return(Ok(responce));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MatchExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            // return Ok();
            // return NoContent();
        }
        /// <summary>
        /// This demo shows how the customer ledger can be printed out, matched and unmatched.
        /// The same code can run for supplier ledger by changing api.Reporting.CustomerLedger to api.Reporting.SupplierLedger.
        /// </summary>
        public static async Task CustomerLedger()
        {
            var authorizationSettings = new AuthorizationSettings
            {
                ApplicationKey = "<You Application Key Here>",
                ClientKey      = "<PowerOffice Go Client Key Here>",
                TokenStore     = new BasicTokenStore(@"my.tokenstore"),
                EndPointHost   = Settings.EndPointMode.Production //For authorization against the demo environment - Change this to Settings.EndPointMode.Demo
            };

            // Initialize the PowerOffice Go API and request authorization
            var api = await Go.CreateAsync(authorizationSettings);

            Console.WriteLine("Customer ledger:");
            PrintStatement(api);
            //PrintOpenItems(api);

            //Create a match request with all IDs that you want matched or unmatched.
            var matchRequest = new MatchRequest(DateTime.Today, new long[] { 2612317, 2890048 });

            //Request to clear matches
            api.Reporting.CustomerLedger.UnmatchEntries(matchRequest);

            //Request to match entries together
            api.Reporting.CustomerLedger.MatchEntries(matchRequest);

            //NOTE: The same API methods also exists on api.Reporting.SupplierLedger
        }
Beispiel #13
0
        public async Task <ActionResult <MatchResponse> > MatchRequest(MatchRequest request)
        {
            var matchResponse = new MatchResponse();

            try
            {
                using var channel = GrpcChannel.ForAddress(FrontendUrl);
                var client = new FrontendServiceClient(channel);

                var searchFields = new SearchFields();
                searchFields.Tags.Add(request.GameMode.ToString());
                var ticket = new Ticket();
                ticket.SearchFields = searchFields;

                CreateTicketRequest createTicketRequest = new CreateTicketRequest();
                createTicketRequest.Ticket = ticket;

                var response = await client.CreateTicketAsync(createTicketRequest);

                matchResponse.TicketId = response.Id;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            return(matchResponse);
        }
Beispiel #14
0
        public async Task ShouldDeleteMatchBeOkHavingDeletedElement()
        {
            //Recupero una Match esistente non utilizzato
            var existing = Scenario.Matches.FirstOrDefault();

            if (existing == null)
            {
                Assert.Inconclusive("Match does not exists");
            }

            //Conteggio gli elementi prima della cancellazione
            var countBefore = Scenario.Matches.Count;

            //Composizione della request
            var request = new MatchRequest {
                MatchId = existing.Id
            };

            //Invoke del metodo
            var response = await Controller.DeleteMatch(request);

            //Parsing della risposta
            var parsed = ParseExpectedOk <MatchContract>(response);

            //Conteggio gli elementi dopo la cancellazione
            var countAfter = Scenario.Matches.Count;

            Assert.IsTrue(
                parsed.Data.MatchId == existing.Id);
            Assert.AreEqual(countBefore - 1, countAfter);
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            var url = "http://localhost:2710//api//WhoScored//GetMatchDetails";

            MatchRequest request = new MatchRequest();

            request.HomeTeamId = 75;
            request.Date       = "03-11-16";

            MatchRequest request2 = new MatchRequest();

            request.HomeTeamId = 256;
            request.Date       = "06-11-16";

            MatchRequest request3 = new MatchRequest();

            request.HomeTeamId = 36;
            request.Date       = "18-11-16";
            string x = "";

            Task.Factory.StartNew(() => x = PostApiCall(url, request));
            Task.Factory.StartNew(() => PostApiCall(url, request2));
            Task.Factory.StartNew(() => PostApiCall(url, request3));

            Console.WriteLine("lecimy tutaj");
            Console.ReadKey();
        }
        public void Should_Match_Player_Parties_In_Multiple_Requests()
        {
            var now = DateTime.Now;

            var party1 = new[] { new Player("bob"), new Player("sue") };
            var party2 = new[] { new Player("jerry"), new Player("james") };

            var request1 = new MatchRequest(party1, new [] { GameTitle.HaloReach }, new [] { GameMode.Slayer }, now);
            var request2 = new MatchRequest(party2, new [] { GameTitle.HaloReach }, new [] { GameMode.Slayer }, now);

            var scores = new Dictionary <Preference, int>
            {
                { new Preference(GameTitle.HaloReach, GameMode.Slayer), 2 }
            };

            _scoreCalculator.Setup(x => x.GetScores(It.IsAny <IEnumerable <MatchRequest> >())).Returns(scores);
            var result  = _sut.Matchmake(GameFormat.TwoVersusTwo, new [] { request1, request2 });
            var matches = result.Matches;

            Assert.Single(matches);
            var match1 = matches.ElementAt(0);

            Assert.Equal(GameFormat.TwoVersusTwo, match1.Format);
            Assert.Equal(GameTitle.HaloReach, match1.Title);
            Assert.Equal(GameMode.Slayer, match1.Mode);
            Assert.Contains(request1, match1.Requests);
            Assert.Contains(request2, match1.Requests);
        }
        public void Identify(MatchRequest request)
        {
            // Clients.All
            if (Program.ServerForm.BenchmarkMode)
            {
                Clients.Caller.addMessage(DateTime.Now, "Got Request. Matching...");
            }

            if (Program.ServerForm.Verbose)
            {
                Program.ServerForm.LogMessage("Got Request. Matching...");
            }

            //Func<CompareResult, CompareResult> callback = (result) =>
            //{
            //    if (result.Success)
            //        Clients.All.addMessage(name, date, "Callback > Scanned: " + result.Scanned);
            //    return null;
            //};

            var result = Program.ServerForm.Identify(request);

            // Clients.All
            Clients.Caller.IdentifyComplete(result);
            if (Program.ServerForm.Verbose)
            {
                Program.ServerForm.LogMessage("Result sent.");
            }
        }
Beispiel #18
0
        public async Task <IActionResult> RealizarMatch([FromBody] MatchRequest request)
        {
            SimpleResponse response = new SimpleResponse();

            if (request.DoacaoId == null || request.DoacaoId == null)
            {
                response.Sucesso  = false;
                response.Mensagem = "É necessário informar o id do item de necesside e de doação";
            }
            else
            {
                try
                {
                    response = await ExecutaMatch(request.NecessidadeId.Value, request.DoacaoId.Value);
                }
                catch (SessaoExpiradaException)
                {
                    return(RedirectToAction("Logout", "Account"));
                }

                response.Sucesso = true;
            }


            return(StatusCode(StatusCodes.Status200OK, response));
        }
        public void Should_Match_Players_With_Longest_Queued_Times_First()
        {
            var now = DateTime.Now;

            var player1 = new[] { new Player("bob") };
            var player2 = new[] { new Player("sue") };
            var player3 = new[] { new Player("jerry") };

            var request1 = new MatchRequest(player1, new [] { GameTitle.HaloReach }, new [] { GameMode.Slayer, GameMode.Swat }, now + TimeSpan.FromSeconds(2));
            var request2 = new MatchRequest(player2, new [] { GameTitle.HaloReach }, new [] { GameMode.Slayer, GameMode.Swat }, now + TimeSpan.FromSeconds(3));
            var request3 = new MatchRequest(player3, new [] { GameTitle.HaloReach }, new [] { GameMode.Slayer }, now);

            var scores = new Dictionary <Preference, int>
            {
                { new Preference(GameTitle.HaloReach, GameMode.Swat), 2 },
                { new Preference(GameTitle.HaloReach, GameMode.Slayer), 3 }
            };

            _scoreCalculator.Setup(x => x.GetScores(It.IsAny <IEnumerable <MatchRequest> >())).Returns(scores);
            var result = _sut.Matchmake(GameFormat.OneVersusOne, new [] { request1, request2, request3 });

            Assert.Single(result.Matches);
            var match = result.Matches.Single();

            Assert.Equal(GameFormat.OneVersusOne, match.Format);
            Assert.Equal(GameTitle.HaloReach, match.Title);
            Assert.Equal(GameMode.Slayer, match.Mode);
            Assert.Contains(request1, match.Requests);
            Assert.Contains(request3, match.Requests);

            Assert.Contains(request2, result.UnmatchedRequests);
        }
        public async Task <IActionResult> DeleteMatch([EntityId] MatchRequest request)
        {
            //Recupero l'elemento dal business layer
            var entity = BasicLayer.GetMatch(request.MatchId);

            //Se l'utente non hai i permessi non posso rimuovere entità con userId nullo
            if (entity == null)
            {
                return(NotFound());
            }

            //Invocazione del service layer
            var validations = await BasicLayer.DeleteMatch(entity, PlatformUtils.GetIdentityUserId(User));

            if (validations.Count > 0)
            {
                return(BadRequest(validations));
            }

            var association = BasicLayer.GetAssociation(entity.AssociationId);
            var place       = BasicLayer.GetPlace(entity.PlaceId);

            //Return contract
            return(Ok(ContractUtils.GenerateContract(entity, association, place)));
        }
        public static void CustomerLedger()
        {
            var authorizationSettings = new AuthorizationSettings
            {
                ApplicationKey = "<You Application Key Here>",
                ClientKey      = "<PowerOffice Go Client Key Here>",
                TokenStore     = new BasicTokenStore(@"my.tokenstore")
            };

            // Initialize the PowerOffice Go API and request authorization
            var api = new Go(authorizationSettings);

            Console.WriteLine("Customer ledger:");
            PrintStatement(api);
            //PrintOpenItems(api);

            //Create a match request with all IDs that you want matched or unmatched.
            var matchRequest = new MatchRequest(DateTime.Today, new long[] { 2612317, 2890048 });

            //Request to clear matches
            api.Reporting.CustomerLedger.UnmatchEntries(matchRequest);

            //Request to match entries together
            api.Reporting.CustomerLedger.MatchEntries(matchRequest);

            //NOTE: The same API methods also exists on api.Reporting.SupplierLedger
        }
        public async Task <ActionResult <ObjectResult <Cascade <int> > > > Submit([FromBody] MatchRequest request)
        {
            if (!await _authManager.HasSitePermissionsAsync(request.SiteId, Types.SitePermissions.TemplatesMatch))
            {
                return(Unauthorized());
            }

            var site = await _siteRepository.GetAsync(request.SiteId);

            if (site == null)
            {
                return(NotFound());
            }

            if (request.ChannelIds != null && request.ChannelIds.Count > 0)
            {
                if (request.IsChannelTemplate)
                {
                    foreach (var channelId in request.ChannelIds)
                    {
                        var channelInfo = await _channelRepository.GetAsync(channelId);

                        channelInfo.ChannelTemplateId = request.TemplateId;
                        await _channelRepository.UpdateChannelTemplateIdAsync(channelInfo);
                    }
                }
                else
                {
                    foreach (var channelId in request.ChannelIds)
                    {
                        var channelInfo = await _channelRepository.GetAsync(channelId);

                        channelInfo.ContentTemplateId = request.TemplateId;
                        await _channelRepository.UpdateContentTemplateIdAsync(channelInfo);
                    }
                }
            }

            await _authManager.AddSiteLogAsync(request.SiteId, "模板匹配");

            var channel = await _channelRepository.GetAsync(request.SiteId);

            var cascade = await _channelRepository.GetCascadeAsync(site, channel, async summary =>
            {
                var count  = await _contentRepository.GetCountAsync(site, summary);
                var entity = await _channelRepository.GetAsync(summary.Id);
                return(new
                {
                    Count = count,
                    entity.ChannelTemplateId,
                    entity.ContentTemplateId
                });
            });

            return(new ObjectResult <Cascade <int> >
            {
                Value = cascade
            });
        }
Beispiel #23
0
    public void OnBeginMatch()
    {
        ClientRequestBase req = null;

        req = new MatchRequest(ClientID, SelectBuildManager.Instance.CurrentSelectedBuildInfo.BuildID);
        SendMessage(req);
        ClientState = ClientStates.Matching;
    }
        private void cmdSendTasks_Click(object sender, EventArgs e)
        {
            var request = new MatchRequest(MatchManager.Cache.Fingerprints[MatchManager.LocaleId][1]); //LastFingerprint);

            request.ExtraRefCode = 123;
            RichTextBoxConsole.AppendText(Environment.NewLine + String.Format("{0}", "Request sent"));
            client.IdentifyAsync(request);
        }
Beispiel #25
0
 public void CreateWithMatchmakerUI(MatchRequest request, IRealTimeMultiplayerListener listener)
 {
     PlayGamesPlatform.Instance.RealTime.CreateWithInvitationScreen(
         request.MinPlayers - 1,
         request.MaxPlayers - 1,
         (uint)GPGTypeConverter.ToGPGSVariant(request.Variant, MatchType.RealTime),
         new GPGRealTimeMultiplayerListener(listener, false));
 }
Beispiel #26
0
 public void CreateQuickMatch(MatchRequest request, IRealTimeMultiplayerListener listener)
 {
     PlayGamesPlatform.Instance.RealTime.CreateQuickGame(
         request.MinPlayers - 1,
         request.MaxPlayers - 1,
         (uint)GPGTypeConverter.ToGPGSVariant(request.Variant, MatchType.RealTime),
         new GPGRealTimeMultiplayerListener(listener, true));
 }
        public async Task <ActionResult <MatchResponse> > FindMatches(MatchRequest request)
        {
            var matches = await _matchService.FindMatchesAsync(request.Text, request.Subtext);

            return(new MatchResponse {
                Text = request.Text, Subtext = request.Subtext, Matches = matches.ToArray()
            });
        }
        public string GetMatchDetails(MatchRequest request)
        {
            //https://www.whoscored.com/Teams/256 (Feyenord) id=256

            MatchDetails details = _whoscoredService.GetMatchDetails(request.Date, request.HomeTeamId);

            return(JsonConvert.SerializeObject(details));
        }
        public Task <IActionResult> FetchAllGroups(MatchRequest request)
        {
            //Recupero la lista dal layer
            var entities = BasicLayer.FetchAllGroupsByMatchId(request.MatchId);

            //Ritorno i contratti
            return(Reply(entities.As(x => ContractUtils.GenerateContract(x))));
        }
Beispiel #30
0
        public void MatchRequest_Defaults()
        {
            var r = new MatchRequest();

            Assert.AreEqual <bool>(false, r.Steps);
            Assert.AreEqual <string>("polyline", r.Geometries);
            Assert.AreEqual <string>("simplified", r.Overview);
            Assert.IsNotNull(r.Timestamps);
        }
        public void TestMatch()
        {
            MatchLogic matchLogic = new MatchLogic();
            var dataManager = new DataManager();
            MatchRequest req = new MatchRequest();

            var userDataPuddy = new UserProfileRequest
            {
                //UserID = 69,
                UserName = "******",
                ProfileAttributeType = ProfileAttributeTypeEnum.All
            };

            UserProfileData match = dataManager.FetchProfile(userDataPuddy);

            // This is elaine.
            req.UserID = 6969;

            MatchResponse response = matchLogic.GetMatchByLocation(req);

            if (response != null)
            {

                if (response.MatchProfiles != null && response.MatchProfiles.Count() > 0)
                {
                    foreach (ChoiceProfile cp in response.MatchProfiles)
                    {
                        cp.ChoiceType =  ChoiceTypeEnum.Like;

                    }

                    // Add the match profiles
                    var userProfileData = new UserProfileData
                    {
                        UserData = match.UserData,
                        UserChoices = response.MatchProfiles
                    };

                    dataManager.ModifyProfile(userProfileData);
                }

            }
        }