示例#1
0
        public void GetNetworkStatusGraphTest()
        {
            NetworksStatusContract status = new NetworksStatusContract();

            var expectedJsonData = "{\"networkStatus\":[{\"key\":\"Live\",\"value\":6},{\"key\":\"Closed\",\"value\":1},{\"key\":\"Not Live\",\"value\":2}],\"clientNetworkStatus\":[{\"key\":\"Live\",\"value\":4},{\"key\":\"Closed\",\"value\":1},{\"key\":\"Not Live\",\"value\":1}],\"nonClientNetworkStatus\":[{\"key\":\"Live\",\"value\":2},{\"key\":\"Not Live\",\"value\":1}]}";

            List <Networks> items = new List <Networks>
            {
                new Networks {
                    networkID = 1101, NetworkName = "Get Go Dallas", status = "Live", intuit = "", isClientNetwork = true,
                    logo      = "", productList = new List <Products>()
                    {
                        Products.LSApi, Products.LSWeb
                    }, websiteURL = ""
                },

                new Networks {
                    networkID = 1103, NetworkName = "Tesco Frisco", status = "Live", intuit = "", isClientNetwork = true,
                    logo      = "", productList = new List <Products>()
                    {
                        Products.LSApi, Products.LSWeb
                    }, websiteURL = ""
                },

                new Networks {
                    networkID = 1104, NetworkName = "Kinemart TX", status = "Live", intuit = "", isClientNetwork = false,
                    logo      = "", productList = new List <Products>()
                    {
                        Products.DIWeb, Products.DIApi
                    }, websiteURL = ""
                },

                new Networks {
                    networkID = 1112, NetworkName = "Walmart TX", status = "Closed", intuit = "", isClientNetwork = true,
                    logo      = "", productList = new List <Products>()
                    {
                        Products.LSApi, Products.LSWeb
                    }, websiteURL = ""
                },

                new Networks {
                    networkID = 1113, NetworkName = "Homedepot", status = "Not Live", intuit = "", isClientNetwork = true,
                    logo      = "", productList = new List <Products>()
                    {
                        Products.Others
                    }, websiteURL = ""
                },

                new Networks {
                    networkID = 1114, NetworkName = "Chase TX", status = "Not Live", intuit = "", isClientNetwork = false,
                    logo      = "", productList = new List <Products>()
                    {
                        Products.DIApi
                    }, websiteURL = ""
                },

                new Networks {
                    networkID = 1115, NetworkName = "Bank Of America", status = "Live", intuit = "", isClientNetwork = false,
                    logo      = "", productList = new List <Products>()
                    {
                        Products.LSWeb
                    }, websiteURL = ""
                },

                new Networks {
                    networkID = 1116, NetworkName = "All point Walgreens", status = "Live", intuit = "", isClientNetwork = true,
                    logo      = "", productList = new List <Products>()
                    {
                        Products.LSWeb, Products.LSApi
                    }, websiteURL = ""
                },

                new Networks {
                    networkID = 1116, NetworkName = "CVS", status = "Live", intuit = "", isClientNetwork = true,
                    logo      = "", productList = new List <Products>()
                    {
                        Products.Others
                    }, websiteURL = ""
                },
            };



            var result = status.GetNetworkStatusGraph(items);
            //JsonConvert.SerializeObject(result);
            var json = JsonConvert.SerializeObject(result);

            Assert.AreEqual(expectedJsonData, json);
        }
        public NetworksStatusContract GetNetworkStatusReport()
        {
            NetworksStatusContract networkStatus = new NetworksStatusContract();

            return(networkStatus.GetNetworkStatusGraph(datas.networks));
        }