コード例 #1
0
        public void opImplicit_PostalAddressFileKey_string(string value)
        {
            var expected = PostalAddressFileKey.FromString(value);
            PostalAddressFileKey actual = value;

            Assert.Equal(expected, actual);
        }
コード例 #2
0
        public void opImplicit_string_PostalAddressFileKey()
        {
            const string expected = "0·0";
            string       actual   = new PostalAddressFileKey();

            Assert.Equal(expected, actual);
        }
コード例 #3
0
        public void op_GetHashCode()
        {
            var expected = "0·0".GetHashCode();
            var actual   = new PostalAddressFileKey().GetHashCode();

            Assert.Equal(expected, actual);
        }
コード例 #4
0
        public void opGreaterThan_PostalAddressFileKey_PostalAddressFileKey(bool expected,
                                                                            string operand1,
                                                                            string operand2)
        {
            var actual = PostalAddressFileKey.FromString(operand1) > PostalAddressFileKey.FromString(operand2);

            Assert.Equal(expected, actual);
        }
コード例 #5
0
        public void op_ToString(string expected,
                                int urn,
                                int umr)
        {
            var actual = new PostalAddressFileKey(urn, umr).ToString();

            Assert.Equal(expected, actual);
        }
コード例 #6
0
        public void op_Compare_PostalAddressFileKey_PostalAddressFileKey(int expected,
                                                                         string operand1,
                                                                         string operand2)
        {
            var actual = PostalAddressFileKey.Compare(operand1, operand2);

            Assert.Equal(expected, actual);
        }
コード例 #7
0
        public void op_CompareTo_PostalAddressFileKey(int expected,
                                                      string operand1,
                                                      string operand2)
        {
            var actual = PostalAddressFileKey.FromString(operand1).CompareTo(operand2);

            Assert.Equal(expected, actual);
        }
コード例 #8
0
        public void op_FromString_string(int urn,
                                         int umr,
                                         string value)
        {
            var actual = PostalAddressFileKey.FromString(value);

            Assert.Equal(urn, actual.UniqueDeliveryPointReferenceNumber);
            Assert.Equal(umr, actual.UniqueMultipleResidenceReferenceNumber);
        }
コード例 #9
0
        public void opEquality_PostalAddressFileKey_PostalAddressFileKey(bool expected,
                                                                         string value,
                                                                         string comparand)
        {
            var a      = PostalAddressFileKey.FromString(value);
            var b      = PostalAddressFileKey.FromString(comparand);
            var actual = a == b;

            Assert.Equal(expected, actual);
        }
コード例 #10
0
        public void op_Equals_object(bool expected,
                                     string value,
                                     string comparand)
        {
            var    a      = PostalAddressFileKey.FromString(value);
            object b      = PostalAddressFileKey.FromString(comparand);
            var    actual = a.Equals(b);

            Assert.Equal(expected, actual);
        }
コード例 #11
0
        public void op_GetObjectData_SerializationInfoNull_StreamingContext()
        {
            var context = new StreamingContext(StreamingContextStates.All);

            ISerializable value = PostalAddressFileKey.FromString("3f·0");

            // ReSharper disable AssignNullToNotNullAttribute
            Assert.Throws <ArgumentNullException>(() => value.GetObjectData(null, context));

            // ReSharper restore AssignNullToNotNullAttribute
        }
コード例 #12
0
        public void ctor_SerializationInfo_StreamingContext()
        {
            PostalAddressFileKey expected = "3f·0";
            PostalAddressFileKey actual;

            using (Stream stream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                formatter.Serialize(stream, PostalAddressFileKey.FromString("3f·0"));
                stream.Position = 0;
                actual          = (PostalAddressFileKey)formatter.Deserialize(stream);
            }

            Assert.Equal(expected, actual);
        }
コード例 #13
0
        public void op_GetObjectData_SerializationInfo_StreamingContext()
        {
            var info    = new SerializationInfo(typeof(PostalAddressFileKey), new FormatterConverter());
            var context = new StreamingContext(StreamingContextStates.All);

            const string urn = "3f";
            const string umr = "0";

            ISerializable value = PostalAddressFileKey.FromString("{0}·{1}".FormatWith(urn, umr));

            value.GetObjectData(info, context);

            Assert.Equal(urn, info.GetString("_urn"));
            Assert.Equal(umr, info.GetString("_umr"));
        }
コード例 #14
0
 public void op_FromString_stringNull()
 {
     Assert.Throws <ArgumentNullException>(() => PostalAddressFileKey.FromString(null));
 }
コード例 #15
0
 public void op_FromString_stringEmpty(string value)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => PostalAddressFileKey.FromString(value));
 }