예제 #1
0
 // assert
 private void AssertHelper(MockSetting setting, List <Setting> settings)
 {
     Assert.True(settings != null);
     Assert.True(settings.Count > 0);
     Assert.True(settings[2].Id > 0);
     //Assert.Equal(3, settings[2].Id);
     Assert.Equal(setting.MyProperty3, settings[2].Value);
 }
예제 #2
0
 private void CreateDiscountSetting()
 {
     _mockSetting = new MockSetting()
     {
         MyProperty1 = 90,
         MyProperty2 = "",
         MyProperty3 = "twenty Percentage of price",
         MyProperty4 = true,
         MyProperty5 = 9000.04M,
         MyProperty6 = 9009890,
     };
 }
예제 #3
0
    public static CByteGame Instance()
    {
        if (ByteGameSDKInstance == null)
        {
            ByteGameSDKInstance = new CByteGame();

            if (Application.isEditor)
            {
                MockSetting.OpenAllMockModule();
                MockSetting.SwithMockModule(MockModule.FollowDouyin, true);
            }
        }
        return(ByteGameSDKInstance);
    }
예제 #4
0
        [Fact] //3
        public async Task SaveSetting_ShouldSuccessfullySaveSetting_WhenSpecifiedSettingIsEmpty()
        {
            var setting = new MockSetting();

            _repository.Delete(x => x.Name.StartsWith("MockSetting"));

            // act
            await _settingService.SaveSetting <MockSetting>(setting);

            var settings = await _repository.FindByAsync(x => x.Name.StartsWith("MockSetting"));

            // assert
            AssertHelper(setting, settings);
        }
예제 #5
0
        [Fact] //4
        public async Task UpdateSetting_ShouldSuccessfullyUpdateSetting_WhenSpecifiedSettingIsModified()
        {
            await SaveDiscountSetting();

            var setting = new MockSetting()
            {
                MyProperty2 = "Testing ...", MyProperty5 = 990.89M, MyProperty6 = 21200000
            };

            // act
            await _settingService.UpdateSetting <MockSetting>(setting);

            var settings = await _repository.FindByAsync(x => x.Name.StartsWith("MockSetting"));

            AssertHelper(setting, settings);
        }