Beispiel #1
0
        private static TimeUUIDType ConvertFrom(object o)
        {
            var type = new TimeUUIDType();

            type.SetValue(o);
            return(type);
        }
Beispiel #2
0
        private static T ConvertTo <T>(TimeUUIDType type)
        {
            if (type == null)
            {
                return(default(T));
            }

            return(type.GetValue <T>());
        }
        public void Guid_To_JavaBytes()
        {
            // arrange

            // act
            TimeUUIDType actual = guid;

            // assert
            Assert.True(actual.ToBigEndian().SequenceEqual(javaByteOrder));
        }
Beispiel #4
0
        public void Guid_To_JavaBytes()
        {
            // arrange

            // act
            TimeUUIDType actual = guid;

            // assert
            Assert.IsTrue(actual.GetValue <byte[]>().SequenceEqual(javaByteOrder));
        }
        public void Implicit_DateTimeOffset_Cast()
        {
            // arrange
            DateTimeOffset expected = DateTimeOffset.Now;

            // act
            TimeUUIDType actual = expected;

            // assert
            Assert.Equal(expected, (DateTimeOffset)actual);
        }
        public void Implicit_Universal_DateTime_Cast()
        {
            // arrange
            DateTime expected = DateTime.UtcNow;

            // act
            TimeUUIDType actual = expected;

            // assert
            Assert.Equal(expected, (DateTime)actual);
        }
        public void Implicit_Guid_Cast()
        {
            // arrange
            Guid expected = guid;

            // act
            TimeUUIDType actual = expected;

            // assert
            Assert.Equal(expected, (Guid)actual);
        }
Beispiel #8
0
		public void JavaBytes_To_Guid()
		{
			// arrange

			// act
			TimeUUIDType actual = new TimeUUIDType();
			actual.SetValueFromBigEndian(javaByteOrder);

			// assert
			Assert.Equal(guid, (Guid)actual);
		}
        public void Operator_EqualTo()
        {
            // arrange
            var          value = guid;
            TimeUUIDType type  = value;

            // act
            bool actual = type.Equals(value);

            // assert
            Assert.True(actual);
        }
        public void Null_to_Guid()
        {
            // arrange

            // act
            TimeUUIDType actual = new TimeUUIDType();

            actual.SetValueFromBigEndian(null);

            // assert
            Assert.Equal(Guid.Empty, (Guid)actual);
        }
        public void CassandraType_Cast()
        {
            // arrange
            Guid         expected   = guid;
            TimeUUIDType actualType = expected;

            // act
            CassandraObject actual = actualType;

            // assert
            Assert.Equal(expected, (Guid)actual);
        }
Beispiel #12
0
		public void Implicit_ByteArray_Cast()
		{
			// arrange
			byte[] expected = dotNetByteOrder;

			// act
			TimeUUIDType actualType = expected;
			byte[] actual = actualType;

			// assert
			Assert.True(expected.SequenceEqual(actual));
		}
Beispiel #13
0
		public void Implicit_Local_DateTime_Cast()
		{
			// arrange
			DateTime expected = DateTime.Now;

			// act
			TimeUUIDType actualType = expected;
			DateTime actual = actualType;
			actual = actual.ToLocalTime();

			// assert
			Assert.Equal(expected, actual);
		}