Ejemplo n.º 1
0
        public async Task GetServersInfo_ReturnsCorrectInfo()
        {
            var data = new[]
            {
                new ServerInfoEntry
                {
                    Endpoint  = "PutServerInfo_SavesInfo",
                    Name      = "NewName",
                    GameModes =
                        new List <StringEntry> {
                        new StringEntry {
                            String = "TM"
                        }, new StringEntry {
                            String = "TDM"
                        }
                    }
                },
                new ServerInfoEntry
                {
                    Endpoint  = "GetServersInfo_ReturnsCorrectInfo2",
                    Name      = "Another",
                    GameModes = new List <StringEntry> {
                        new StringEntry {
                            String = "TESTDM"
                        }
                    }
                }
            };

            await statistics.PutServerInfo(data[1].Endpoint, data[1]);

            var result = statistics.GetServersInfo().Result;

            result.Count.ShouldBeEquivalentTo(data.Length);
            for (var i = 0; i < data.Length; i++)
            {
                result[i].Endpoint.ShouldBeEquivalentTo(data[i].Endpoint);
                result[i].Info.Name.ShouldBeEquivalentTo(data[i].Name);
                result[i].Info.GameModes.Count.ShouldBeEquivalentTo(data[i].GameModes.Count);
                for (int j = 0; j < result[i].Info.GameModes.Count; j++)
                {
                    result[i].Info.GameModes[j].ShouldBeEquivalentTo(data[i].GameModes[j].String);
                }
            }
        }
Ejemplo n.º 2
0
 public async Task <List <ServersInfo> > GetServersInfo()
 {
     return(await statistics.GetServersInfo());
 }