Esempio n. 1
0
        public void NetworkConverter_Convert_Success()
        {
            var config = new ConverterConfiguration()
            {
                LeftSideMap = new Dictionary <string, List <string> >()
                {
                    { "MacAddress", new List <string>()
                      {
                          "NetworkCard"
                      } }
                },
                Properties = new Dictionary <string, string>()
            };

            config.Properties.Add("IP Address", "IPAddress");

            var converter = new NetworkConverter();

            converter.Configure(config);

            var macDataPoint = new KeyValuePair <string, object>("MacAddress", "00:11:22:33:44:55");
            var data         = new EntityCollection();

            data.Entities.Add(macDataPoint.Key, macDataPoint.Value);

            var ipDataPoint = new KeyValuePair <string, object>("IPAddress", "1.2.3.4");

            data.Entities.Add(ipDataPoint.Key, ipDataPoint.Value);

            var convertedPoints = converter.Convert(macDataPoint, data);

            convertedPoints.Should().NotBeNull();

            var networkCard = convertedPoints["NetworkCard"] as NetworkCard;

            networkCard.MacAddress.Should().Equals("00:11:22:33:44:55");
            networkCard.IPAddress.Should().Equals("1.2.3.4");
        }