Пример #1
0
        public async Task Manager_Save_ChangeProviderName_Test()
        {
            var sto = new SampleSettingSto
            {
                Name          = "Tom",
                Age           = 30,
                MaritalStatus = true,
                Asset         = 5000
            };

            sto.SetSettingProviderName("test");
            await Assert.ThrowsAsync <ArgumentNullException>(async() =>
                                                             await _settingModelManager.SaveAsync <SampleSettingSto>(sto)
                                                             );

            sto.SetSettingProviderName(UserSettingValueProvider.ProviderName);
            await _settingModelManager.SaveAsync <SampleSettingSto>(sto);

            _sampleSetting.Name.ShouldBe(SampleSetting.NameDefaultValue);
            _sampleSetting.Age.ShouldBe(0);
            _sampleSetting.MaritalStatus.ShouldBeFalse();
            _sampleSetting.Asset.ShouldBe(0);

            _sampleSetting.SetValueProviderName(UserSettingValueProvider.ProviderName);
            _sampleSetting.Name.ShouldBe(sto.Name);
            _sampleSetting.Age.ShouldBe(sto.Age);
            _sampleSetting.MaritalStatus.ShouldBe(sto.MaritalStatus);
            _sampleSetting.Asset.ShouldBe(sto.Asset);
        }
Пример #2
0
        public async Task Manager_Save_BigValue_Test()
        {
            var sto = new SampleSettingSto
            {
                Name          = NameValue,
                Age           = 30,
                MaritalStatus = true,
                Asset         = 5000
            };
            await _settingModelManager.SaveAsync <SampleSettingSto>(sto);

            _sampleSetting.Name.Length.ShouldBeGreaterThan(SettingConsts.MaxValueLength);
            _sampleSetting.Name.ShouldBe(NameValue);
        }
Пример #3
0
        public async Task Manager_Save_Basic_Test()
        {
            _sampleSetting.Name.ShouldBe(SampleSetting.NameDefaultValue);
            _sampleSetting.Age.ShouldBe(0);
            _sampleSetting.MaritalStatus.ShouldBeFalse();
            _sampleSetting.Asset.ShouldBe(0);

            var sto = new SampleSettingSto
            {
                Name          = "Tom",
                Age           = 30,
                MaritalStatus = true,
                Asset         = 5000
            };
            await _settingModelManager.SaveAsync <SampleSettingSto>(sto);

            _sampleSetting.Name.ShouldBe(sto.Name);
            _sampleSetting.Age.ShouldBe(sto.Age);
            _sampleSetting.MaritalStatus.ShouldBe(sto.MaritalStatus);
            _sampleSetting.Asset.ShouldBe(sto.Asset);
        }