Exemplo n.º 1
0
        public void GetAlleysNameTest()
        {
            var t = new GameService();

            Assert.Empty(t.GetAlleysName());
            t.AddPlay(new Play("teste", 10, "1", DateTime.Now));
            Assert.Single(t.GetAlleysName());
            t.AddPlay(new Play("teste", 10, "2", DateTime.Now));
            Assert.Equal(2, t.GetAlleysName().Count);
        }
Exemplo n.º 2
0
        public void AddPlayTest()
        {
            var          t     = new GameService();
            const string alley = "1";

            Assert.False(t.IsExistsAlley(alley));
            t.AddPlay(new Play("teste", 10, alley, DateTime.Now));
            Assert.True(t.IsExistsAlley(alley));
        }
Exemplo n.º 3
0
        public void ClearTest()
        {
            var          t     = new GameService();
            const string alley = "1";

            Assert.False(t.IsExistsAlley(alley));
            t.AddPlay(new Play("teste", 10, alley, DateTime.Now));
            Assert.True(t.IsExistsAlley(alley));
            t.Clear(alley);
            Assert.Empty(t.GetPainel(alley).Players);
        }
Exemplo n.º 4
0
        public void GetPainelTest()
        {
            var          t     = new GameService();
            const string alley = "1";

            Assert.Null(t.GetPainel(alley));
            t.AddPlay(new Play("teste", 10, alley, DateTime.Now));
            var rst = t.GetPainel(alley);

            Assert.NotNull(rst);
            Assert.IsType <Painel>(rst);
        }
Exemplo n.º 5
0
 public void GetScoreAsyncTest()
 {
     Task.Run(async() =>
     {
         var t = new GameService();
         const string alley = "1";
         Assert.Null(await t.GetScoreAsync(alley));
         t.AddPlay(new Play("teste", 10, alley, DateTime.Now));
         var rst = await t.GetScoreAsync(alley);
         Assert.NotNull(rst);
         Assert.IsType <Painel>(rst);
     }).GetAwaiter().GetResult();
 }
Exemplo n.º 6
0
 public void EventsTest()
 {
     Task.Run(async() =>
     {
         var t              = new GameService();
         t.OnPlay          += EventOnPlay;
         t.OnChange        += EventOnChange;
         const string alley = "1";
         Assert.Null(await t.GetScoreAsync(alley));
         t.AddPlay(new Play("teste", 10, alley, DateTime.Now));
         var rst = await t.GetScoreAsync(alley);
         Assert.NotNull(rst);
         Assert.IsType <Painel>(rst);
         t.Clear(alley);
         Assert.Empty(rst.Players);
     }).GetAwaiter().GetResult();
 }