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

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