コード例 #1
0
        public void opGreaterThan_ValueObjectOfTNull_ValueObjectOfT()
        {
            var operand2 = new ValueObjectDerived
                               {
                                   Int32Property = 123
                               };

            Assert.False(null > operand2);
        }
コード例 #2
0
        public void opGreaterThan_ValueObjectOfT_ValueObjectOfTNull()
        {
            var operand1 = new ValueObjectDerived
                               {
                                   Int32Property = 123
                               };

            Assert.True(operand1 > null);
        }
コード例 #3
0
        public void opEquality_ValueObjectOfT_ValueObjectOfT_whenSame()
        {
            var operand1 = new ValueObjectDerived
                               {
                                   Int32Property = 123
                               };
            var operand2 = operand1;

            Assert.True(operand1 == operand2);
        }
コード例 #4
0
        public void opEquality_ValueObjectOfT_ValueObjectOfT_whenFalse()
        {
            var operand1 = new ValueObjectDerived
                               {
                                   Int32Property = 456
                               };
            var operand2 = new ValueObjectDerived
                               {
                                   Int32Property = 123
                               };

            Assert.False(operand1 == operand2);
        }
コード例 #5
0
        public void op_Equals_T()
        {
            var obj = new ValueObjectDerived
                          {
                              DateTimeProperty = new DateTime(1999, 12, 31),
                              Int32Property = 123
                          };

            var comparand = new ValueObjectDerived
                                {
                                    DateTimeProperty = XmlConvert.ToDateTime(obj.DateTimeProperty.ToXmlString(), XmlDateTimeSerializationMode.Utc),
                                    Int32Property = 123
                                };

            Assert.True(obj.Equals(comparand));
        }
コード例 #6
0
        public void op_Compare_ValueObjectOfT_ValueObjectOfT_whenSame()
        {
            var comparand1 = new ValueObjectDerived
                                 {
                                     Int32Property = 123
                                 };
            var comparand2 = comparand1;

            Assert.Equal(0, ValueObjectDerived.Compare(comparand1, comparand2));
        }
コード例 #7
0
        public void opInequality_ValueObjectOfT_ValueObjectOfT_whenTrue()
        {
            var operand1 = new ValueObjectDerived
                               {
                                   Int32Property = 456
                               };
            var operand2 = new ValueObjectDerived
                               {
                                   Int32Property = 123
                               };

            Assert.True(operand1 != operand2);
        }
コード例 #8
0
        public void op_ToString()
        {
            var obj = new ValueObjectDerived
                          {
                              DateTimeProperty = new DateTime(1999, 12, 31),
                              Int32Property = 123,
                              StringProperty = "test"
                          };

            // ReSharper disable SpecifyACultureInStringConversionExplicitly
            var expected = string.Concat(new DateTime(1999, 12, 31).ToString(), Environment.NewLine, "123", Environment.NewLine, "test");

            // ReSharper restore SpecifyACultureInStringConversionExplicitly
            var actual = obj.ToString();

            Assert.Equal(expected, actual);
        }
コード例 #9
0
        public void op_Equals_objectSame()
        {
            var obj = new ValueObjectDerived();

            Assert.True(obj.Equals(obj as object));
        }
コード例 #10
0
        public void op_Equals_TSame()
        {
            var obj = new ValueObjectDerived();

            Assert.True((obj as IEquatable<ValueObjectDerived>).Equals(obj));
        }
コード例 #11
0
        public void op_CompareTo_objectLesser()
        {
            var left = new ValueObjectDerived
                           {
                               Int32Property = 123
                           };
            var right = new ValueObjectDerived
                            {
                                Int32Property = 456
                            };

            Assert.True(left.CompareTo(right) < 0);
        }
コード例 #12
0
        public void op_CompareTo_object()
        {
            var left = new ValueObjectDerived
                           {
                               Int32Property = 123
                           };
            var right = new ValueObjectDerived
                            {
                                Int32Property = 123
                            };

            Assert.Equal(0, left.CompareTo(right));
        }
コード例 #13
0
        public void opLessThan_ValueObjectOfT_ValueObjectOfT_whenTrue()
        {
            var operand1 = new ValueObjectDerived
                               {
                                   Int32Property = 123
                               };
            var operand2 = new ValueObjectDerived
                               {
                                   Int32Property = 456
                               };

            Assert.True(operand1 < operand2);
        }
コード例 #14
0
        public void opLessThan_ValueObjectOfT_ValueObjectOfT_whenSame()
        {
            var operand1 = new ValueObjectDerived
                               {
                                   Int32Property = 123
                               };
            var operand2 = operand1;

            Assert.False(operand1 < operand2);
        }
コード例 #15
0
        public void opLessThan_ValueObjectOfT_ValueObjectOfTNull()
        {
            var operand1 = new ValueObjectDerived
                               {
                                   Int32Property = 123
                               };

            Assert.False(operand1 < null);
        }
コード例 #16
0
        public void opLessThan_ValueObjectOfTNull_ValueObjectOfT()
        {
            var operand2 = new ValueObjectDerived
                               {
                                   Int32Property = 123
                               };

            Assert.True(null < operand2);
        }
コード例 #17
0
        public void op_Equals_TDiffers()
        {
            var obj = new ValueObjectDerived();

            var comparand = new ValueObjectDerived
                                {
                                    Int32Property = 123
                                };

            Assert.False((obj as IEquatable<ValueObjectDerived>).Equals(comparand));
        }
コード例 #18
0
        public void op_CompareTo_objectNull()
        {
            var obj = new ValueObjectDerived
                          {
                              Int32Property = 123
                          };

            Assert.True(obj.CompareTo(null) > 0);
        }
コード例 #19
0
        public void op_Equals_objectDiffers()
        {
            var obj = new ValueObjectDerived();

            var comparand = new ValueObjectDerived
                                {
                                    Int32Property = 123
                                };

            Assert.False(obj.Equals(comparand as object));
        }
コード例 #20
0
        public void op_CompareTo_objectSame()
        {
            var obj = new ValueObjectDerived
                          {
                              Int32Property = 123
                          };

            Assert.Equal(0, obj.CompareTo(obj));
        }
コード例 #21
0
        public void op_Equals_objectString()
        {
            var obj = new ValueObjectDerived
                          {
                              StringProperty = "foo"
                          };

            Assert.False(obj.Equals("foo"));
        }
コード例 #22
0
        public void op_Compare_ValueObjectOfTLesser_ValueObjectOfT()
        {
            var comparand1 = new ValueObjectDerived
                                 {
                                     Int32Property = 123
                                 };
            var comparand2 = new ValueObjectDerived
                                 {
                                     Int32Property = 456
                                 };

            Assert.True(ValueObjectDerived.Compare(comparand1, comparand2) < 0);
        }
コード例 #23
0
        public void op_Compare_ValueObjectOfTNull_ValueObjectOfT()
        {
            var comparand2 = new ValueObjectDerived
                                 {
                                     Int32Property = 123
                                 };

            Assert.True(ValueObjectDerived.Compare(null, comparand2) < 0);
        }
コード例 #24
0
        public void op_Compare_ValueObjectOfT_ValueObjectOfTNull()
        {
            var comparand1 = new ValueObjectDerived
                                 {
                                     Int32Property = 123
                                 };

            Assert.True(ValueObjectDerived.Compare(comparand1, null) > 0);
        }
コード例 #25
0
        public void opGreaterThan_ValueObjectOfT_ValueObjectOfT_whenFalse()
        {
            var operand1 = new ValueObjectDerived
                               {
                                   Int32Property = 123
                               };
            var operand2 = new ValueObjectDerived
                               {
                                   Int32Property = 456
                               };

            Assert.False(operand1 > operand2);
        }
コード例 #26
0
        public void opImplicit_string_ValueObjectOfT()
        {
            var expected = "31/12/1999 00:00:00" + Environment.NewLine + "123";
            var actual = new ValueObjectDerived
                             {
                                 DateTimeProperty = new DateTime(1999, 12, 31),
                                 Int32Property = 123
                             };

            Assert.Equal(expected, actual);
        }