コード例 #1
0
        public void WhenCallKeyMapperThenKeyMapperIsNotNull()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Key(km => km.Should().Not.Be.Null());
        }
コード例 #2
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void WhenCallKeyMapperThenKeyMapperIsNotNull()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Key(km => Assert.That(km, Is.Not.Null));
        }
コード例 #3
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void CanSetFetch()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Fetch(FetchKind.Select);
            Assert.That(hbmJoin.fetch, Is.EqualTo(HbmJoinFetch.Select));
        }
コード例 #4
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void CanSetOptional()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Optional(true);
            Assert.That(hbmJoin.optional, Is.True);
        }
コード例 #5
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void CanSetInverse()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Inverse(true);
            Assert.That(hbmJoin.inverse, Is.True);
        }
コード例 #6
0
        public void CanSetSchema()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Schema("pizza");
            hbmJoin.schema.Should().Be("pizza");
        }
コード例 #7
0
        public void CanSetCatalog()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Catalog("pizza");
            hbmJoin.catalog.Should().Be("pizza");
        }
コード例 #8
0
        public void CanSetFetch()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Fetch(FetchKind.Select);
            hbmJoin.fetch.Should().Be(HbmJoinFetch.Select);
        }
コード例 #9
0
        public void CanSetTable()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Table("   Pizza   ");
            hbmJoin.table.Should().Be("Pizza");
        }
コード例 #10
0
        public void CanSetInverse()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Inverse(true);
            hbmJoin.inverse.Should().Be.True();
        }
コード例 #11
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void CanSetCatalog()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Catalog("pizza");
            Assert.That(hbmJoin.catalog, Is.EqualTo("pizza"));
        }
コード例 #12
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void CanSetTable()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Table("   Pizza   ");
            Assert.That(hbmJoin.table, Is.EqualTo("Pizza"));
        }
コード例 #13
0
        public void CanSetOptional()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Optional(true);
            hbmJoin.optional.Should().Be.True();
        }
コード例 #14
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void WhenAddPropertyThenAddItem()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Property(For <MyClass> .Property(mc => mc.Something), x => { });

            Assert.That(hbmJoin.Properties.Count(), Is.EqualTo(1));
        }
コード例 #15
0
        public void WhenSetTableNameEmptyThenThrows()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Executing(x => x.Table(null)).Throws <ArgumentNullException>();
            mapper.Executing(x => x.Table("")).Throws <ArgumentOutOfRangeException>();
            mapper.Executing(x => x.Table("    ")).Throws <ArgumentOutOfRangeException>();
        }
コード例 #16
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void WhenSetTableNameEmptyThenThrows()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            Assert.That(() => mapper.Table(null), Throws.TypeOf <ArgumentNullException>());
            Assert.That(() => mapper.Table(""), Throws.TypeOf <ArgumentOutOfRangeException>());
            Assert.That(() => mapper.Table("    "), Throws.TypeOf <ArgumentOutOfRangeException>());
        }
コード例 #17
0
        public void WhenAddPropertyThenAddItem()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Property(For <MyClass> .Property(mc => mc.Something), x => { });

            hbmJoin.Properties.Should().Have.Count.EqualTo(1);
        }
コード例 #18
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void CanSetSqlSubselect()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Subselect("blah");

            Assert.That(hbmJoin.Subselect, Is.Not.Null);
            Assert.That(hbmJoin.subselect.Text[0], Is.EqualTo("blah"));
        }
コード例 #19
0
        public void CallKeyMapper()
        {
            var mapdoc          = new HbmMapping();
            var hbmJoin         = new HbmJoin();
            var mapper          = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
            var keyMapperCalled = false;

            mapper.Key(km => keyMapperCalled = true);

            keyMapperCalled.Should().Be.True();
        }
コード例 #20
0
        public void CanSetSqlSubselect()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.Subselect("blah");

            hbmJoin.Subselect.Should().Not.Be.Null();
            hbmJoin.subselect.Text[0].Should().Be("blah");
        }
コード例 #21
0
        public void SetSqlDelete()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.SqlDelete("blah");

            hbmJoin.SqlDelete.Should().Not.Be.Null();
            hbmJoin.SqlDelete.Text[0].Should().Be("blah");
        }
コード例 #22
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void SetSqlDelete()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.SqlDelete("blah");

            Assert.That(hbmJoin.SqlDelete, Is.Not.Null);
            Assert.That(hbmJoin.SqlDelete.Text[0], Is.EqualTo("blah"));
        }
コード例 #23
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void CallKeyMapper()
        {
            var mapdoc          = new HbmMapping();
            var hbmJoin         = new HbmJoin();
            var mapper          = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
            var keyMapperCalled = false;

            mapper.Key(km => keyMapperCalled = true);

            Assert.That(keyMapperCalled, Is.True);
        }
コード例 #24
0
        public void SetSqlDeleteWithCheck()
        {
            var mapdoc  = new HbmMapping();
            var hbmJoin = new HbmJoin();
            var mapper  = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.SqlDelete("blah", SqlCheck.RowCount);

            Assert.That(hbmJoin.SqlDelete, Is.Not.Null);
            Assert.That(hbmJoin.SqlDelete.Text[0], Is.EqualTo("blah"));
            Assert.That(hbmJoin.SqlDelete.checkSpecified, Is.True);
            Assert.That(hbmJoin.SqlDelete.check, Is.EqualTo(HbmCustomSQLCheck.Rowcount));
        }
コード例 #25
0
        public void WhenCallKeyMapperMoreThanOnceThenKeyMapperIsTheSame()
        {
            var        mapdoc             = new HbmMapping();
            var        hbmJoin            = new HbmJoin();
            var        mapper             = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);
            IKeyMapper firstCallInstance  = null;
            IKeyMapper secondCallInstance = null;

            mapper.Key(km => firstCallInstance  = km);
            mapper.Key(km => secondCallInstance = km);

            firstCallInstance.Should().Be.SameInstanceAs(secondCallInstance);
        }
コード例 #26
0
        public void WhenTableNameChangesValueThenNotify()
        {
            bool eventCalled = false;
            var  mapdoc      = new HbmMapping();
            var  hbmJoin     = new HbmJoin();
            var  mapper      = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.TableNameChanged += (m, x) =>
            {
                m.Should().Be.SameInstanceAs(mapper);
                x.OldName.Should().Be("AA");
                x.NewName.Should().Be("Pizza");
                eventCalled = true;
            };
            mapper.Table("   Pizza   ");
            eventCalled.Should().Be.True();
        }
コード例 #27
0
ファイル: JoinMapperTests.cs プロジェクト: jrauber/GH1429
        public void WhenTableNameChangesValueThenNotify()
        {
            bool eventCalled = false;
            var  mapdoc      = new HbmMapping();
            var  hbmJoin     = new HbmJoin();
            var  mapper      = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc);

            mapper.TableNameChanged += (m, x) =>
            {
                Assert.That(m, Is.SameAs(mapper));
                Assert.That(x.OldName, Is.EqualTo("AA"));
                Assert.That(x.NewName, Is.EqualTo("Pizza"));
                eventCalled = true;
            };
            mapper.Table("   Pizza   ");
            Assert.That(eventCalled, Is.True);
        }