Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 9
0
 public void ReadType_throws_on_invalid_arguments()
 {
     Assert.That(() => IdReader.ReadType(null), Throws.TypeOf <ArgumentNullException>());
 }
Esempio n. 10
0
 public void ReadType_throws_when_no_id_field_present()
 {
     Assert.That(() => IdReader.ReadType <TestMetadata>(), Throws.ArgumentException);
 }