Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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 }));
        }
Ejemplo n.º 9
0
        public void ThrowOnOddIndexExpression()
        {
            var config = NeedToDash.Configure();

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