Esempio n. 1
0
        public void Should_Return_Null_When_Whitespace_String_Is_Mapped()
        {
            var mapper = new NetworkResponseJsonMapper();

            string obj    = "   ";
            var    actual = mapper.Map(obj);

            Assert.IsNull(actual);
        }
        public void Should_Return_Null_When_Whitespace_String_Is_Mapped()
        {
            var mapper = new NetworkResponseJsonMapper();

            string obj = "   ";
            var actual = mapper.Map(obj);

            Assert.IsNull(actual);
        }
Esempio n. 3
0
        public void Should_Return_Null_When_Null_JObject_Is_Mapped()
        {
            var mapper = new NetworkResponseJsonMapper();

            JObject obj    = null;
            var     actual = mapper.Map(obj);

            Assert.IsNull(actual);
        }
        public void Should_Return_Null_When_Null_JObject_Is_Mapped()
        {
            var mapper = new NetworkResponseJsonMapper();

            JObject obj = null;
            var actual = mapper.Map(obj);

            Assert.IsNull(actual);
        }
Esempio n. 5
0
        public void Should_Return_Network_With_2_Addresseses()
        {
            var mapper = new NetworkResponseJsonMapper();

            string obj    = "{\"public\": [{\"version\": 4, \"addr\": \"166.78.156.150\"}, {\"version\": 6, \"addr\": \"2001:4800:7812:0514:95e4:7f4d:ff04:d1eb\"}]}";
            var    actual = mapper.Map(obj);

            Assert.IsNotNull(actual);
            Assert.AreEqual(actual.Addresses.Count(), 2);
        }
Esempio n. 6
0
        public void Should_Return_Network_With_Single_Addresses()
        {
            var mapper = new NetworkResponseJsonMapper();

            string obj    = "{\"public\": [{\"version\": 4, \"addr\": \"166.78.156.150\"}]}";
            var    actual = mapper.Map(obj);

            Assert.IsNotNull(actual);
            Assert.AreEqual(actual.Addresses.Count(), 1);
        }
Esempio n. 7
0
        public void Should_Return_Network_With_No_Addresses()
        {
            var mapper = new NetworkResponseJsonMapper();

            string obj    = "{\"public\": []}";
            var    actual = mapper.Map(obj);

            Assert.IsNotNull(actual);
            Assert.IsFalse(actual.Addresses.Any());
        }
        public void Should_Return_Network_With_2_Addresseses()
        {
            var mapper = new NetworkResponseJsonMapper();

            string obj = "{\"public\": [{\"version\": 4, \"addr\": \"166.78.156.150\"}, {\"version\": 6, \"addr\": \"2001:4800:7812:0514:95e4:7f4d:ff04:d1eb\"}]}";
            var actual = mapper.Map(obj);

            Assert.IsNotNull(actual);
            Assert.AreEqual(actual.Addresses.Count(), 2);
        }
        public void Should_Return_Network_With_Single_Addresses()
        {
            var mapper = new NetworkResponseJsonMapper();

            string obj = "{\"public\": [{\"version\": 4, \"addr\": \"166.78.156.150\"}]}";
            var actual = mapper.Map(obj);

            Assert.IsNotNull(actual);
            Assert.AreEqual(actual.Addresses.Count(), 1);
        }
        public void Should_Return_Network_With_No_Addresses()
        {
            var mapper = new NetworkResponseJsonMapper();

            string obj = "{\"public\": []}";
            var actual = mapper.Map(obj);

            Assert.IsNotNull(actual);
            Assert.IsFalse(actual.Addresses.Any());
        }
Esempio n. 11
0
        public void Should_Return_Network_With_Both_v4_And_v6_Addresseses()
        {
            var mapper = new NetworkResponseJsonMapper();

            string obj    = "{\"public\": [{\"version\": 4, \"addr\": \"166.78.156.150\"}, {\"version\": 6, \"addr\": \"2001:4800:7812:0514:95e4:7f4d:ff04:d1eb\"}]}";
            var    actual = mapper.Map(obj);

            Assert.IsNotNull(actual);
            Assert.IsNotNull(actual.Addresses.SingleOrDefault(a => a.Version == "4"));
            Assert.IsNotNull(actual.Addresses.SingleOrDefault(a => a.Version == "6"));
        }
        public void Should_Return_Network_With_Both_v4_And_v6_Addresseses()
        {
            var mapper = new NetworkResponseJsonMapper();

            string obj = "{\"public\": [{\"version\": 4, \"addr\": \"166.78.156.150\"}, {\"version\": 6, \"addr\": \"2001:4800:7812:0514:95e4:7f4d:ff04:d1eb\"}]}";
            var actual = mapper.Map(obj);

            Assert.IsNotNull(actual);
            Assert.IsNotNull(actual.Addresses.SingleOrDefault(a => a.Version == "4"));
            Assert.IsNotNull(actual.Addresses.SingleOrDefault(a => a.Version == "6"));
        }