예제 #1
0
        public void ThrowOnIndexingIgnoredColumn()
        {
            var config = NeedToDash.Configure();

            config.Setup <Post>().Property(p => p.Title).Ignore();
            Assert.Throws <InvalidOperationException>(() => config.Setup <Post>().Index(p => p.Title));
        }
예제 #2
0
        public void ThrowOnIndexingIgnoredColumn()
        {
            var config = NeedToDash.Configure(new ConnectionStringSettings("Default", string.Empty, "System.Data.SqlClient"));

            config.Setup <Post>().Property(p => p.Title).Ignore();
            Assert.Throws <InvalidOperationException>(() => config.Setup <Post>().Index(p => p.Title));
        }
예제 #3
0
        public void UniqueAddedCorrectly()
        {
            var config = NeedToDash.Configure(new ConnectionStringSettings("Default", string.Empty, "System.Data.SqlClient"));

            config.Setup <Blog>();
            config.Setup <User>();
            config.Setup <Post>().Index(p => new { p.Rating, p.Title }, true);
            Assert.True(config.GetMap <Post>().Indexes.First(i => i.Columns.Count == 2).IsUnique);
        }
예제 #4
0
        public void UniqueAddedCorrectly()
        {
            var config = NeedToDash.Configure();

            config.Setup <Blog>();
            config.Setup <User>();
            config.Setup <Post>().Index(p => new { p.Rating, p.Title }, true);
            Assert.True(config.GetMap <Post>().Indexes.First(i => i.Columns.Count == 2).IsUnique);
        }
예제 #5
0
        public void SingleColumnAddedCorrectly()
        {
            var config = NeedToDash.Configure();

            config.Setup <Blog>();
            config.Setup <User>();
            config.Setup <Post>().Index(p => p.Title);
            Assert.Equal(1, config.GetMap <Post>().Indexes.First(i => i.Columns.Count == 1).Columns.Count(c => c.Name == "Title"));
        }
예제 #6
0
        public void IndexExtensionWorks()
        {
            var config = NeedToDash.Configure(new ConnectionStringSettings("Default", string.Empty, "System.Data.SqlClient"));

            config.Setup <Blog>();
            config.Setup <User>();
            config.Setup <Post>().Index(p => new { p.Rating, p.Title });
            Assert.Equal(1, config.GetMap <Post>().Indexes.First(i => i.Columns.Count == 2).Columns.Count(c => c.Name == "Rating"));
            Assert.Equal(1, config.GetMap <Post>().Indexes.First(i => i.Columns.Count == 2).Columns.Count(c => c.Name == "Title"));
        }
예제 #7
0
        public void IndexExtensionWorks()
        {
            var config = NeedToDash.Configure();

            config.Setup <Blog>();
            config.Setup <User>();
            config.Setup <Post>().Index(p => new { p.Rating, p.Title });
            Assert.Equal(1, config.GetMap <Post>().Indexes.First(i => i.Columns.Count == 2).Columns.Count(c => c.Name == "Rating"));
            Assert.Equal(1, config.GetMap <Post>().Indexes.First(i => i.Columns.Count == 2).Columns.Count(c => c.Name == "Title"));
        }
예제 #8
0
        public void ThrowOnOddIndexExpression()
        {
            var config = NeedToDash.Configure(new ConnectionStringSettings("Default", string.Empty, "System.Data.SqlClient"));

            Assert.Throws <InvalidOperationException>(() => config.Setup <Post>().Index(p => new { Blah = p.Title }));
        }
예제 #9
0
        public void ThrowOnOddIndexExpression()
        {
            var config = NeedToDash.Configure();

            Assert.Throws <InvalidOperationException>(() => config.Setup <Post>().Index(p => new { Blah = p.Title }));
        }