示例#1
0
 /// <summary>
 ///   Remove member from the conference
 /// </summary>
 /// <param name="instance">>Instance of <see cref="IPlayAudio" /></param>
 /// <param name="conferenceId">Id of the conference</param>
 /// <param name="memberId">Id of the member to remove</param>
 /// <returns>Task instance for async operation</returns>
 public static Task DeleteMemberAsync(this IConference instance, string conferenceId, string memberId)
 {
     return(instance.UpdateMemberAsync(conferenceId, memberId,
                                       new UpdateConferenceMemberData {
         State = ConferenceMemberState.Completed
     }));
 }
示例#2
0
 /// <summary>
 ///   Hold/Unhold the conference member
 /// </summary>
 /// <param name="instance">>Instance of <see cref="IPlayAudio" /></param>
 /// <param name="conferenceId">Id of the conference</param>
 /// <param name="memberId">Id of the member</param>
 /// <param name="hold">'true' to hold member or 'false'</param>
 /// <returns>Task instance for async operation</returns>
 public static Task HoldMemberAsync(this IConference instance, string conferenceId, string memberId, bool hold)
 {
     return(instance.UpdateMemberAsync(conferenceId, memberId,
                                       new UpdateConferenceMemberData {
         Hold = hold
     }));
 }
示例#3
0
        public void Conference_Constructor()
        {
            IConference nfc = this.NFL.GetConference("NFC");
            IConference afc = this.NFL.GetConference("AFC");

            switch (this.LeagueDataFile.StripPath())
            {
            case "NFL_2016.xml":
            case "NFL_2017.xml":
                Assert.AreEqual("NFC", nfc.Name);
                Assert.AreEqual("AFC", afc.Name);
                Assert.AreEqual(4, nfc.Divisions.Count());
                Assert.AreEqual(4, afc.Divisions.Count());
                Assert.AreEqual(1, nfc.Divisions.Count(d => d.Name == "North"));
                Assert.AreEqual(1, nfc.Divisions.Count(d => d.Name == "South"));
                Assert.AreEqual(1, nfc.Divisions.Count(d => d.Name == "East"));
                Assert.AreEqual(1, nfc.Divisions.Count(d => d.Name == "West"));
                Assert.AreEqual(1, afc.Divisions.Count(d => d.Name == "North"));
                Assert.AreEqual(1, afc.Divisions.Count(c => c.Name == "South"));
                Assert.AreEqual(1, afc.Divisions.Count(c => c.Name == "East"));
                Assert.AreEqual(1, afc.Divisions.Count(c => c.Name == "West"));
                break;

            default:
                break;
            }
        }
示例#4
0
 public ConferenceService(ConferenceRepository conferRepository, ListenerConfRepository listenerRepository,
                          ReportConferenceRepository reportRepository)
 {
     _conferRepository   = conferRepository;
     _listenerRepository = listenerRepository;
     _reportRepository   = reportRepository;
 }
示例#5
0
        public void TestGetNewConference()
        {
            List <ITalk> talks      = InputParser.Instance.GetTalks(TestData.Talks);
            IConference  conference = Factory.Instance.GetNewConference(talks);

            Assert.True(null != conference && conference.Date == DateTime.Today);
        }
示例#6
0
 /// <summary>
 ///   Mute/Unmute the conference member
 /// </summary>
 /// <param name="instance">>Instance of <see cref="IPlayAudio" /></param>
 /// <param name="conferenceId">Id of the conference</param>
 /// <param name="memberId">Id of the member</param>
 /// <param name="mute">'true' to mute member or 'false'</param>
 /// <returns>Task instance for async operation</returns>
 public static Task MuteMemberAsync(this IConference instance, string conferenceId, string memberId, bool mute)
 {
     return(instance.UpdateMemberAsync(conferenceId, memberId,
                                       new UpdateConferenceMemberData {
         Mute = mute
     }));
 }
示例#7
0
 public Conference(IConference source)
 {
     Id = source.Id;
     Title = source.Title;
     State = source.State;
     AccidentId = source.AccidentId;
 }
示例#8
0
        public void TestScheduleTalksWithBalanceTalks()
        {
            List <ITalk> talks      = GetTalks(TestData.TalksWithBalanceTalks);
            IConference  conference = Factory.Instance.GetNewConference(talks);

            conference.ScheduleTalks();
            Assert.True(conference.UnscheduledTalks.Count == 4);
        }
示例#9
0
        public void TestScheduleTalksWithTalksToTestBufferAllocation()
        {
            List <ITalk> talks      = GetTalks(TestData.TalksToTestBufferAllocation);
            IConference  conference = Factory.Instance.GetNewConference(talks);

            conference.ScheduleTalks();
            Assert.True(conference.UnscheduledTalks.Count == 0);
        }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the SNEKPrepService class.
 /// </summary>
 /// <param name='rootHandler'>
 /// Optional. The http client handler used to handle http transport.
 /// </param>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public SNEKPrepService(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
     : base(rootHandler, handlers)
 {
     this._conference = new Conference(this);
     this._sessions   = new Sessions(this);
     this._speakers   = new Speakers(this);
     this._baseUri    = new Uri("https://snekprepservice.azurewebsites.net");
 }
 /// <param name='operations'>
 /// Reference to the MyUniversalWindows10App.IConference.
 /// </param>
 public static SpeakerInfo GetTopSpeakers(this IConference operations)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IConference)s).GetTopSpeakersAsync();
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
示例#12
0
 /// <summary>
 /// Initializes a new instance of the SNEKPrepService class.
 /// </summary>
 public SNEKPrepService()
     : base()
 {
     this._conference = new Conference(this);
     this._sessions   = new Sessions(this);
     this._speakers   = new Speakers(this);
     this._baseUri    = new Uri("https://snekprepservice.azurewebsites.net");
 }
示例#13
0
        public void TestConferenceConstructor()
        {
            List <ITalk> talks      = GetTalks(TestData.Talks);
            IConference  conference = Factory.Instance.GetNewConference(talks);

            Assert.True(conference.UnscheduledTalks.Count == talks.Count &&
                        conference.Date == DateTime.Today);
        }
示例#14
0
 public ChatVM(IChatHub chat, IFile file, IConference conference)
 {
     _chat       = chat;
     _file       = file;
     _conference = conference;
     _chat.NewCompanionMessage += AddMessage;
     _chat.MessageDeleted      += DeleteMessage;
     _chat.MessageUpdated      += UpdateMessage;
 }
            public static SessionController Create(IConference conference)
            {
                var conferenceLoader = Substitute.For <IConferenceLoader>();

                conferenceLoader.LoadConference().Returns(conference);
                var controller = new SessionController(conferenceLoader, Substitute.For <IUserProfileRepository>(), Substitute.For <ISessionRepository>(), Substitute.For <ISessionSorter>());

                return(controller);
            }
示例#16
0
        public void TestScheduleTalksFailure()
        {
            List <ITalk> talks      = GetTalks(TestData.TalksWithInvalidSum);
            IConference  conference = Factory.Instance.GetNewConference(talks);

            conference.ScheduleTalks();
            //UnscheduledTalks will be empty after all the talks are scheduled.
            Assert.True(conference.UnscheduledTalks.Count == 4);
        }
示例#17
0
 /// <summary>
 ///   Play audio file by url
 /// </summary>
 /// <param name="instance">>Instance of <see cref="IPlayAudio" /></param>
 /// <param name="conferenceId">Id of the conference</param>
 /// <param name="memberId">Id of the member to play audio</param>
 /// <param name="fileUrl">Url to file to play</param>
 /// <param name="tag">A string that will be included in the events delivered when the audio playback starts or finishes</param>
 /// <param name="cancellationToken">
 ///   Optional token to cancel async operation
 /// </param>
 /// <returns>Task instance for async operation</returns>
 /// <example>
 ///   <code>
 /// await client.Conference.PlayAudioFileToMemberAsync("conferenceId", "memberId, "http://host/path/to/file.mp3");
 /// </code>
 /// </example>
 public static Task PlayAudioFileToMemberAsync(this IConference instance, string conferenceId, string memberId,
                                               string fileUrl, string tag          = null,
                                               CancellationToken?cancellationToken = null)
 {
     return(instance.PlayAudioToMemberAsync(conferenceId, memberId, new PlayAudioData
     {
         FileUrl = fileUrl,
         Tag = tag
     }, cancellationToken));
 }
        /// <summary>
        /// Prints the output.
        /// </summary>
        /// <param name="testData">The test data.</param>
        private static void PrintOutput(List <string> testData)
        {
            Console.WriteLine(Resource.OutputTitle + Environment.NewLine);
            var         talks      = InputParser.Instance.GetTalks(testData);
            IConference conference = Factory.Instance.GetNewConference(talks, DateTime.Today);

            conference.ScheduleTalks();
            Console.WriteLine();
            Console.Write(conference.ToString());
        }
示例#19
0
 public void SortSessions(IConference conference, List <SessionDisplayModel> sessions)
 {
     if (conference.CanVote())
     {
         _votingSort.Sort(sessions);
     }
     else
     {
         _defaultSort.Sort(sessions);
     }
 }
 public void SortSessions(IConference conference, List<SessionDisplayModel> sessions)
 {
     if (conference.CanVote())
     {
         _votingSort.Sort(sessions);
     }
     else
     {
         _defaultSort.Sort(sessions);
     }
 }
示例#21
0
 /// <summary>
 ///   Speak a sentence
 /// </summary>
 /// <param name="instance">Instance of <see cref="IPlayAudio" /></param>
 /// <param name="conferenceId">Id of the conference</param>
 /// <param name="memberId">Id of the member to play audio</param>
 /// <param name="sentence">The sentence to speak</param>
 /// <param name="gender">The gender of the voice used to synthesize the sentence.</param>
 /// <param name="voice">The voice to speak the sentence.</param>
 /// <param name="locale">The locale used to get the accent of the voice used to synthesize the sentence.</param>
 /// <param name="tag">A string that will be included in the events delivered when the audio playback starts or finishes</param>
 /// <param name="cancellationToken">
 ///   Optional token to cancel async operation
 /// </param>
 /// <returns>Task instance for async operation</returns>
 /// <example>
 ///   <code>
 /// await client.Conference.SpeakSentenceToMemberAsync("conferenceId", "memberId, "Hello");
 /// </code>
 /// </example>
 public static Task SpeakSentenceToMemberAsync(this IConference instance, string conferenceId, string memberId,
                                               string sentence, Gender gender = Gender.Female,
                                               string voice = "susan", string locale = "en_US", string tag = null,
                                               CancellationToken?cancellationToken = null)
 {
     return(instance.PlayAudioToMemberAsync(conferenceId, memberId, new PlayAudioData
     {
         Sentence = sentence,
         Gender = gender,
         Voice = voice,
         Locale = locale,
         Tag = tag
     }, cancellationToken));
 }
示例#22
0
        public IUserProfileFilter Create(IConference conference)
        {
            IUserProfileFilter userProfileFilter;

            if (conference.CanPublishAgenda())
            {
                userProfileFilter = new SelectedSpeakerProfileFilter(SelectedSessions.SpeakerIds);
            }
            else
            {
                userProfileFilter = new SubmittedSessionProfileFilter(sessionRepository);
            }

            return(userProfileFilter);
        }
        public ISessionLoader Create(IConference conference)
        {
            ISessionLoader sessionLoader;

            if (conference.CanPublishAgenda())
            {
                sessionLoader = new SelectedSessionsLoader(sessionRepository);
            }
            else
            {
                sessionLoader = new AllSessionsLoader(sessionRepository);
            }

            return sessionLoader;
        }
        public IUserProfileFilter Create(IConference conference)
        {
            IUserProfileFilter userProfileFilter;

            if (conference.CanPublishAgenda())
            {
                userProfileFilter = new SelectedSpeakerProfileFilter();
            }
            else
            {
                userProfileFilter = new SubmittedSessionProfileFilter(sessionRepository);
            }

            return userProfileFilter;
        }
示例#25
0
        public ISessionLoader Create(IConference conference)
        {
            ISessionLoader sessionLoader;

            if (conference.CanPublishAgenda())
            {
                sessionLoader = new SelectedSessionsLoader(sessionRepository, SelectedSessions.SessionIds);
            }
            else
            {
                sessionLoader = new AllSessionsLoader(sessionRepository);
            }

            return(sessionLoader);
        }
示例#26
0
        public void Conference_DefensiveRank()
        {
            IConference nfc = this.NFL.GetConference("NFC");
            IConference afc = this.NFL.GetConference("AFC");

            switch (this.StatsDataFile.StripPath())
            {
            case "NFLStats_2016.xml":
                Assert.AreEqual(15, nfc.DefensiveRankings["NO"]);
                Assert.ThrowsException <KeyNotFoundException>(() => afc.DefensiveRankings["NO"]);
                break;

            case "NFLStats_2017.xml":
                Assert.AreEqual(5, nfc.DefensiveRankings["NO"]);
                Assert.ThrowsException <KeyNotFoundException>(() => afc.DefensiveRankings["NO"]);
                break;

            default:
                break;
            }
        }
示例#27
0
        public void Conference_WinPercentage()
        {
            IConference nfc      = this.NFL.GetConference("NFC");
            ITeam       saints   = this.NFL.GetTeam("NO");
            ITeam       seahawks = this.NFL.GetTeam("SEA");

            switch (this.StatsDataFile.StripPath())
            {
            case "NFLStats_2016.xml":
                Assert.AreEqual((6.0 / 12.0), nfc.WinPercentage(saints));
                Assert.AreEqual(((6.0 + (1.0 * 0.5)) / 12.0), nfc.WinPercentage(seahawks));
                break;

            case "NFLStats_2017.xml":
                Assert.AreEqual((8.0 / 12.0), nfc.WinPercentage(saints));
                break;

            default:
                break;
            }
        }
示例#28
0
        public void Conference_NetPoints()
        {
            IConference nfc    = this.NFL.GetConference("NFC");
            IConference afc    = this.NFL.GetConference("AFC");
            ITeam       saints = this.NFL.GetTeam("NO");

            switch (this.StatsDataFile.StripPath())
            {
            case "NFLStats_2016.xml":
                Assert.AreEqual(23, nfc.NetPoints(saints));
                //Assert.AreEqual(-8, afc.NetPoints(saints));
                break;

            case "NFLStats_2017.xml":
                Assert.AreEqual(69, nfc.NetPoints(saints));
                //Assert.AreEqual(53, afc.NetPoints(saints));
                break;

            default:
                break;
            }
        }
示例#29
0
        private int HeadToHead(ITeam x, ITeam y)
        {
            IConference  conf        = GetConference(x);
            List <ITeam> tiedTeams   = conf.Divisions.SelectMany(d => d.Teams).Where(t => t.WinPercentage == x.WinPercentage).ToList();
            int          returnValue = 0;

            // Remove team X
            tiedTeams.Remove(x);

            // Remove any division champions from this list
            tiedTeams.RemoveAll(t => IsDivisionChampion(t));

            if (tiedTeams.Count > 2)  // If there is a 3 (or more) way tie
            {
                bool isVictor = true;
                foreach (ITeam t in tiedTeams)
                {
                    // Basically, only return 1 if team X has beaten all other teams.
                    // if it has not, returnValue remains 0, tiebreaker continues down the list
                    if (x.HeadToHead(t.ID) != 1)
                    {
                        isVictor = false;
                    }
                }
                if (isVictor)
                {
                    returnValue = 1;
                }
            }
            else // if there is a 2 way tie
            {
                returnValue = x.HeadToHead(y.ID);
            }

            return(returnValue);
        }
 public ConferenceLoaderBuilder()
 {
     conference = Substitute.For<IConference>();
     conferenceLoader = Substitute.For<IConferenceLoader>();
     conferenceLoader.LoadConference().Returns(conference);
 }
示例#31
0
 public ConferenceLoaderBuilder()
 {
     conference       = Substitute.For <IConference>();
     conferenceLoader = Substitute.For <IConferenceLoader>();
     conferenceLoader.LoadConference().Returns(conference);
 }
示例#32
0
 /// <summary>
 /// Initializes a new instance of the SessionsController class.
 /// </summary>
 /// <param name="conferenceRepo">Conference repository to use</param>
 public TracksController(IConference conferenceRepo)
 {
     this._conference = conferenceRepo;
 }
示例#33
0
 public ConferenceService(ConferenceRepository conferRepository)
 {
     _conferRepository = conferRepository;
 }
示例#34
0
 public void UpdateConference(IConference conference)
 {
     using (var ctx = new DataContext())
     {
         var dbConference = ctx.Conferences.Single(x => x.Id == conference.Id);
         dbConference.State = conference.State;
         dbConference.Title = conference.Title;
         dbConference.AccidentId = conference.AccidentId;
         ctx.SaveChanges();
     }
 }
示例#35
0
 /// <summary>
 /// Initializes a new instance of the SessionsController class.
 /// </summary>
 /// <param name="conferenceRepo"></param>
 public SessionsController(IConference conferenceRepo)
 {
     this._conference = conferenceRepo;
 }
示例#36
0
        public void Conference_DefensiveRankings()
        {
            IConference nfc = this.NFL.GetConference("NFC");
            IConference afc = this.NFL.GetConference("AFC");
            Dictionary <string, int> ranks = new Dictionary <string, int>();

            switch (this.StatsDataFile.StripPath())
            {
            case "NFLStats_2016.xml":
                ranks = nfc.DefensiveRankings;
                Assert.AreEqual(1, ranks["NYG"]);
                Assert.AreEqual(2, ranks["SEA"]);
                Assert.AreEqual(3, ranks["DAL"]);
                Assert.AreEqual(4, ranks["MIN"]);
                Assert.AreEqual(5, ranks["PHI"]);
                Assert.AreEqual(6, ranks["DET"]);
                Assert.AreEqual(7, ranks["ARI"]);
                Assert.AreEqual(8, ranks["TB"]);
                Assert.AreEqual(9, ranks["WAS"]);
                Assert.AreEqual(10, ranks["GB"]);
                Assert.AreEqual(11, ranks["LA"]);
                Assert.AreEqual(12, ranks["CHI"]);
                Assert.AreEqual(13, ranks["CAR"]);
                Assert.AreEqual(14, ranks["ATL"]);
                Assert.AreEqual(15, ranks["NO"]);
                Assert.AreEqual(16, ranks["SF"]);

                ranks = afc.DefensiveRankings;
                Assert.AreEqual(1, ranks["NE"]);
                Assert.AreEqual(2, ranks["DEN"]);
                Assert.AreEqual(3, ranks["KC"]);
                Assert.AreEqual(4, ranks["CIN"]);
                Assert.AreEqual(5, ranks["BAL"]);
                Assert.AreEqual(6, ranks["PIT"]);
                Assert.AreEqual(7, ranks["HOU"]);
                Assert.AreEqual(8, ranks["BUF"]);
                Assert.AreEqual(8, ranks["TEN"]);
                Assert.AreEqual(10, ranks["MIA"]);
                Assert.AreEqual(11, ranks["OAK"]);
                Assert.AreEqual(12, ranks["IND"]);
                Assert.AreEqual(13, ranks["JAX"]);
                Assert.AreEqual(14, ranks["NYJ"]);
                Assert.AreEqual(15, ranks["SD"]);
                Assert.AreEqual(16, ranks["CLE"]);
                break;

            case "NFLStats_2017.xml":
                ranks = nfc.DefensiveRankings;
                Assert.AreEqual(1, ranks["MIN"]);
                Assert.AreEqual(2, ranks["PHI"]);
                Assert.AreEqual(3, ranks["ATL"]);
                Assert.AreEqual(4, ranks["CHI"]);
                Assert.AreEqual(5, ranks["NO"]);
                Assert.AreEqual(6, ranks["CAR"]);
                Assert.AreEqual(7, ranks["LA"]);
                Assert.AreEqual(8, ranks["DAL"]);
                Assert.AreEqual(8, ranks["SEA"]);
                Assert.AreEqual(10, ranks["ARI"]);
                Assert.AreEqual(11, ranks["DET"]);
                Assert.AreEqual(12, ranks["TB"]);
                Assert.AreEqual(13, ranks["SF"]);
                Assert.AreEqual(14, ranks["GB"]);
                Assert.AreEqual(15, ranks["WAS"]);
                Assert.AreEqual(15, ranks["NYG"]);

                ranks = afc.DefensiveRankings;
                Assert.AreEqual(1, ranks["JAX"]);
                Assert.AreEqual(2, ranks["LAC"]);
                Assert.AreEqual(3, ranks["NE"]);
                Assert.AreEqual(4, ranks["BAL"]);
                Assert.AreEqual(5, ranks["PIT"]);
                Assert.AreEqual(6, ranks["KC"]);
                Assert.AreEqual(7, ranks["CIN"]);
                Assert.AreEqual(8, ranks["TEN"]);
                Assert.AreEqual(9, ranks["BUF"]);
                Assert.AreEqual(10, ranks["OAK"]);
                Assert.AreEqual(11, ranks["DEN"]);
                Assert.AreEqual(11, ranks["NYJ"]);
                Assert.AreEqual(13, ranks["MIA"]);
                Assert.AreEqual(14, ranks["IND"]);
                Assert.AreEqual(15, ranks["CLE"]);
                Assert.AreEqual(16, ranks["HOU"]);
                break;

            default:
                break;
            }
        }
示例#37
0
 /// <summary>
 /// Initializes a new instance of the SessionsController class.
 /// </summary>
 /// <param name="conferenceRepo"></param>
 public SessionsController(IConference conferenceRepo)
 {
     this._conference = conferenceRepo;
 }
示例#38
0
 /// <summary>
 /// Initializes a new instance of the SpeakersController class.
 /// </summary>
 /// <param name="conferenceRepo"></param>
 public SpeakersController(IConference conferenceRepo)
 {
     this.conferenceRepo = conferenceRepo;
 }
        /// <param name='operations'>
        /// Reference to the MyUniversalWindows10App.IConference.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <string> GetTopSpeakerNameAsync(this IConference operations, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <string> result = await operations.GetTopSpeakerNameWithOperationResponseAsync(cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }