コード例 #1
0
        public void FactionStats_successfully_returns_a_list_of_V1FwFactionStats()
        {
            Mock <IWebClient> mockedWebClient = new Mock <IWebClient>();

            string json = "[\r\n  {\r\n    \"faction_id\": 500001,\r\n    \"kills\": {\r\n      \"last_week\": 893,\r\n      \"total\": 684350,\r\n      \"yesterday\": 136\r\n    },\r\n    \"pilots\": 28863,\r\n    \"systems_controlled\": 20,\r\n    \"victory_points\": {\r\n      \"last_week\": 102640,\r\n      \"total\": 52658260,\r\n      \"yesterday\": 15980\r\n    }\r\n  }\r\n]";

            mockedWebClient.Setup(x => x.Get(It.IsAny <WebHeaderCollection>(), It.IsAny <string>(), It.IsAny <int>())).Returns(new EsiModel {
                Model = json
            });

            InternalLatestFactionWarfare internalLatestFactionWarfare = new InternalLatestFactionWarfare(mockedWebClient.Object, string.Empty);

            IList <V1FwFactionStats> result = internalLatestFactionWarfare.FactionStats();

            Assert.Equal(500001, result[0].FactionId);
            Assert.Equal(893, result[0].Kills.LastWeek);
            Assert.Equal(684350, result[0].Kills.Total);
            Assert.Equal(136, result[0].Kills.Yesterday);
            Assert.Equal(28863, result[0].Pilots);
            Assert.Equal(20, result[0].SystemsControlled);
            Assert.Equal(102640, result[0].VictoryPoints.LastWeek);
            Assert.Equal(52658260, result[0].VictoryPoints.Total);
            Assert.Equal(15980, result[0].VictoryPoints.Yesterday);
        }