Exemplo n.º 1
0
        public void WritingDefaultValues_InsertUserId_IsSet()
        {
            var writingDefaults = new WriteDefaultInsertValues();;

            var testEntities = new List <WriteDefaultsTestEntity>()
            {
                new WriteDefaultsTestEntity()
            };

            writingDefaults.SetDefaultValues(testEntities);
            Assert.AreNotEqual(default(DateTime), testEntities[0].InsertDate);
        }
Exemplo n.º 2
0
        public void WritingDefaultValues_CustomValue_IsSetWithAction()
        {
            var writingDefaults = new WriteDefaultInsertValues();;

            var testEntities = new List <WriteDefaultsTestEntity>()
            {
                new WriteDefaultsTestEntity()
            };

            writingDefaults.AddCustomValueSetter <WriteDefaultsTestEntity>(e => e.CustomInt = 1);

            writingDefaults.SetDefaultValues(testEntities);
            Assert.AreEqual(1, testEntities[0].CustomInt);
        }
Exemplo n.º 3
0
        public void WritingDefaultValues_MultipleCustomSetter_ValuesAreSet()
        {
            var writingDefaults = new WriteDefaultInsertValues();;

            var testEntities = new List <WriteDefaultsTestEntity>()
            {
                new WriteDefaultsTestEntity()
            };

            writingDefaults.AddCustomValueSetter <WriteDefaultsTestEntity>(e => e.CustomInt    = 1);
            writingDefaults.AddCustomValueSetter <WriteDefaultsTestEntity>(e => e.CustomString = "Hello");

            writingDefaults.SetDefaultValues(testEntities);

            Assert.AreEqual(1, testEntities[0].CustomInt);
            Assert.AreEqual("Hello", testEntities[0].CustomString);
        }