示例#1
0
        public void Test_save()
        {
            var testObj = new NTestObject()
            {
                ID = 200,
                Text = "updateCreate",
                Type = TypeEnum.Ignore
            };

            BaseRepository.GetCommand<ICreateCommand<NTestObject>>().Create(testObj);

            var check = BaseRepository.GetCommand<IFindByPkCommand<NTestObject>>().FindByPk(200);

            Assert.AreEqual(testObj, check);

            var updateObj = check;
            updateObj.ID = 200;
            updateObj.Text = "updateSave";
            updateObj.Type = TypeEnum.Ignore;

            BaseRepository.GetCommand<IUpdateCommand<NTestObject>>().Update(updateObj);

            check = BaseRepository.GetCommand<IFindByPkCommand<NTestObject>>().FindByPk(200);

            Assert.AreEqual(updateObj, check);
        }
示例#2
0
        public void Test_create()
        {
            var testObj = new NTestObject()
            {
                ID = 100,
                Text = "create",
                Type = TypeEnum.Ignore
            };

            BaseRepository.GetCommand<ICreateCommand<NTestObject>>().Create(testObj);

            var check = BaseRepository.GetCommand<IFindByPkCommand<NTestObject>>().FindByPk(100);

            Assert.AreEqual(testObj, check);
        }