コード例 #1
0
        public void HasIndex_should_add_index_properties()
        {
            var mockEntityTypeConfiguration = new Mock <EntityTypeConfiguration>(typeof(Fixture));
            var entityConfiguration         = new EntityTypeConfiguration <Fixture>(mockEntityTypeConfiguration.Object);

            mockEntityTypeConfiguration.Setup(e => e.Index(new PropertyPath(new[] { typeof(Fixture).GetDeclaredProperty("Id") })))
            .Throws(new Exception("Bang!"));


            var thrownException = Assert.Throws <Exception>(
                () => entityConfiguration.HasIndex(f => f.Id));

            Assert.Equal("Bang!", thrownException.Message);
        }