Пример #1
0
        public void ReadType_reads_Id_field()
        {
            var type = IdReader.ReadType <TestModel2>();

            type.Should().Be(typeof(int));

            var type2 = IdReader.ReadType(typeof(TestModel2));

            type2.Should().Be(typeof(int));
        }
Пример #2
0
        public void ReadType_reads_Id_property()
        {
            var type = IdReader.ReadType <TestModel>();

            type.Should().Be(typeof(Guid));

            var type2 = IdReader.ReadType(typeof(TestModel));

            type2.Should().Be(typeof(Guid));
        }
Пример #3
0
        public void ReadType_reads_underscore_id_field()
        {
            var type = IdReader.ReadType <TestModel6>();

            type.Should().Be(typeof(double));

            var type2 = IdReader.ReadType(typeof(TestModel6));

            type2.Should().Be(typeof(double));
        }
Пример #4
0
        public void ReadType_reads_underscore_id_property()
        {
            var type = IdReader.ReadType <TestModel5>();

            type.Should().Be(typeof(float));

            var type2 = IdReader.ReadType(typeof(TestModel5));

            type2.Should().Be(typeof(float));
        }
Пример #5
0
        public void ReadType_reads_lowercase_id_field()
        {
            var type = IdReader.ReadType <TestModel4>();

            type.Should().Be(typeof(long));

            var type2 = IdReader.ReadType(typeof(TestModel4));

            type2.Should().Be(typeof(long));
        }
Пример #6
0
        public void ReadType_reads_lowercase_id_property()
        {
            var type = IdReader.ReadType <TestModel3>();

            type.Should().Be(typeof(string));

            var type2 = IdReader.ReadType(typeof(TestModel3));

            type2.Should().Be(typeof(string));
        }
Пример #7
0
        public void ReadType_reads_user_defined_id_field()
        {
            IdReader.SetIdMember <TestModel8>("entityId");
            var type = IdReader.ReadType <TestModel8>();

            type.Should().Be(typeof(ulong));

            var type2 = IdReader.ReadType(typeof(TestModel8));

            type2.Should().Be(typeof(ulong));
        }
Пример #8
0
        public void ReadType_reads_user_defined_id_property()
        {
            IdReader.SetIdMember <TestModel7>("MyId");
            var type = IdReader.ReadType <TestModel7>();

            type.Should().Be(typeof(uint));

            var type2 = IdReader.ReadType(typeof(TestModel7));

            type2.Should().Be(typeof(uint));
        }
Пример #9
0
 public void ReadType_throws_on_invalid_arguments()
 {
     Assert.That(() => IdReader.ReadType(null), Throws.TypeOf <ArgumentNullException>());
 }
Пример #10
0
 public void ReadType_throws_when_no_id_field_present()
 {
     Assert.That(() => IdReader.ReadType <TestMetadata>(), Throws.ArgumentException);
 }