Пример #1
0
        public static SettingDTO Map(this Setting source)
        {
            SettingDTO target = new SettingDTO();

            target.Id = source.Id;
            target.IdUser = source.IdUser;
            target.Name = source.Name;
            target.Value = source.Value;

            return target;
        }
        public void TestRelations()
        {
            using (Hobby.SimpleInjector.SimpleInjectorConsole.Instance.BeginLifetimeScope())
            {
                var uow = IoCCProvider.Container.GetInstance<IUnitOfWork>();

                var setting = new SettingDTO
                {
                    IdUser = 10000000,
                    Name = "test",
                    Value = true
                };

                uow.Settings.Add(setting.Map());
                uow.Save();

                Assert.IsNull(setting.Id);
            }
        }