@@ -1012,6 +1012,88 @@ public void SetServalConfig_UnknownError()
10121012 env . ExceptionHandler . Received ( ) . RecordEndpointInfoForException ( Arg . Any < Dictionary < string , string > > ( ) ) ;
10131013 }
10141014
1015+ [ Test ]
1016+ public async Task SetQualityEstimationConfig_Success ( )
1017+ {
1018+ var env = new TestEnvironment ( ) ;
1019+ var qualityEstimationConfig = new QualityEstimationConfig
1020+ {
1021+ Version = 0.1M ,
1022+ Slope = 109.6145 ,
1023+ Intercept = - 14.0633 ,
1024+ } ;
1025+
1026+ // SUT
1027+ var result = await env . Controller . SetQualityEstimationConfig ( Project01 , qualityEstimationConfig ) ;
1028+ Assert . That ( result , Is . InstanceOf < RpcMethodSuccessResult > ( ) ) ;
1029+ await env
1030+ . SFProjectService . Received ( )
1031+ . SetQualityEstimationConfigAsync ( User01 , Roles , Project01 , qualityEstimationConfig ) ;
1032+ }
1033+
1034+ [ Test ]
1035+ public async Task SetQualityEstimationConfig_Forbidden ( )
1036+ {
1037+ var env = new TestEnvironment ( ) ;
1038+ var qualityEstimationConfig = new QualityEstimationConfig
1039+ {
1040+ Version = 0.1M ,
1041+ Slope = 109.6145 ,
1042+ Intercept = - 14.0633 ,
1043+ } ;
1044+ env . SFProjectService . SetQualityEstimationConfigAsync ( User01 , Roles , Project01 , qualityEstimationConfig )
1045+ . Throws ( new ForbiddenException ( ) ) ;
1046+
1047+ // SUT
1048+ var result = await env . Controller . SetQualityEstimationConfig ( Project01 , qualityEstimationConfig ) ;
1049+ Assert . That ( result , Is . InstanceOf < RpcMethodErrorResult > ( ) ) ;
1050+ Assert . That ( ( result as RpcMethodErrorResult ) ? . ErrorCode , Is . EqualTo ( RpcControllerBase . ForbiddenErrorCode ) ) ;
1051+ await env
1052+ . SFProjectService . Received ( )
1053+ . SetQualityEstimationConfigAsync ( User01 , Roles , Project01 , qualityEstimationConfig ) ;
1054+ }
1055+
1056+ [ Test ]
1057+ public async Task SetQualityEstimationConfig_NotFound ( )
1058+ {
1059+ var env = new TestEnvironment ( ) ;
1060+ var qualityEstimationConfig = new QualityEstimationConfig
1061+ {
1062+ Version = 0.1M ,
1063+ Slope = 109.6145 ,
1064+ Intercept = - 14.0633 ,
1065+ } ;
1066+ const string errorMessage = "Not Found" ;
1067+ env . SFProjectService . SetQualityEstimationConfigAsync ( User01 , Roles , Project01 , qualityEstimationConfig )
1068+ . Throws ( new DataNotFoundException ( errorMessage ) ) ;
1069+
1070+ // SUT
1071+ var result = await env . Controller . SetQualityEstimationConfig ( Project01 , qualityEstimationConfig ) ;
1072+ Assert . That ( result , Is . InstanceOf < RpcMethodErrorResult > ( ) ) ;
1073+ Assert . That ( ( result as RpcMethodErrorResult ) ? . Message , Is . EqualTo ( errorMessage ) ) ;
1074+ Assert . That ( ( result as RpcMethodErrorResult ) ? . ErrorCode , Is . EqualTo ( RpcControllerBase . NotFoundErrorCode ) ) ;
1075+ }
1076+
1077+ [ Test ]
1078+ public void SetQualityEstimationConfig_UnknownError ( )
1079+ {
1080+ var env = new TestEnvironment ( ) ;
1081+ var qualityEstimationConfig = new QualityEstimationConfig
1082+ {
1083+ Version = 0.1M ,
1084+ Slope = 109.6145 ,
1085+ Intercept = - 14.0633 ,
1086+ } ;
1087+ env . SFProjectService . SetQualityEstimationConfigAsync ( User01 , Roles , Project01 , qualityEstimationConfig )
1088+ . Throws ( new ArgumentNullException ( ) ) ;
1089+
1090+ // SUT
1091+ Assert . ThrowsAsync < ArgumentNullException > ( ( ) =>
1092+ env . Controller . SetQualityEstimationConfig ( Project01 , qualityEstimationConfig )
1093+ ) ;
1094+ env . ExceptionHandler . Received ( ) . RecordEndpointInfoForException ( Arg . Any < Dictionary < string , string > > ( ) ) ;
1095+ }
1096+
10151097 [ Test ]
10161098 public async Task SetUsfmConfig_Success ( )
10171099 {
0 commit comments