public override void NewGuid()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(SetNewGuidValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                GuidValue = new Guid()
            });

            Assert.NotEqual(default, insertedEntity.GuidValue);
コード例 #2
0
        protected override void StringTrimSql()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(TrimStringValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                StringField = "              AbS"
            });

            Assert.Equal("AbS", insertedEntity.StringField);
        }
コード例 #3
0
        protected override void StringConcatSql()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(ConcatStringExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                StringField = "daw "
            });

            Assert.Equal("daw abc", insertedEntity.StringField);
        }
コード例 #4
0
        public override void MathCosSql()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(MathCosDoubleValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                DoubleValue = -1,
            });

            Assert.Equal(0.5403, CustomMathRound(insertedEntity.DoubleValue.Value));
        }
コード例 #5
0
        public override void MathCeilingDoubleSql()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(MathCeilingDoubleValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                DoubleValue = -1.36,
            });

            Assert.Equal(-1, insertedEntity.DoubleValue);
        }
コード例 #6
0
        public override void MathAbsDecimalSql()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(MathAbsDecimalValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                DecimalValue = -2.04M,
            });

            Assert.Equal(2.04M, insertedEntity.DecimalValue);
        }
        public override void BooleanValueSql()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(SetBooleanValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                BooleanValue = true
            });

            Assert.Equal(false, insertedEntity.BooleanValue);
        }
        public override void IntMultiplySql()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(MultiplyIntValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                IntValue = 12
            });

            Assert.Equal(24, insertedEntity.IntValue);
        }
        public override void DoubleSubSql()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(SubDoubleValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                DoubleValue = 10.3
            });

            Assert.Equal(13.3, insertedEntity.DoubleValue);
        }
        public override void DecimalAddSql()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(AddDecimalValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                DecimalValue = 10.3M
            });

            Assert.Equal(13.3M, insertedEntity.DecimalValue);
        }
        public override void EnumValueSql()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(SetEnumValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                EnumValue = EnumValue.Value1
            });

            Assert.Equal(EnumValue.Value1, insertedEntity.EnumValue);
        }
コード例 #12
0
        protected override void StringContainsSql()
        {
            var insertedEntity = ContextOptionsFactory.CheckTrigger(ContainsStringValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                StringField = "    abs    abc      AbS"
            });

            Assert.Equal(true, insertedEntity.BooleanValue);
            insertedEntity = ContextOptionsFactory.CheckTrigger(ContainsStringValueExpression, SetupDbContext, SetupModelBuilder, new SourceEntity
            {
                StringField = "   dknjp;;s jd"
            });
            Assert.Equal(false, insertedEntity.BooleanValue);
        }
コード例 #13
0
        protected override void StringEndsWithSql()
        {
            var sourceEntities = new[]
            {
                new SourceEntity {
                    StringField = "  abs abcid abc"
                },
                new SourceEntity {
                    StringField = "  abc dknjp;;s jd"
                }
            };

            var insertedEntities = ContextOptionsFactory.CheckTrigger(EndsWithStringValueExpression, SetupDbContext, SetupModelBuilder, sourceEntities);


            Assert.Equal(2, insertedEntities.Length);
            Assert.True(insertedEntities[0].BooleanValue);
            Assert.False(insertedEntities[1].BooleanValue);
        }