My application is a .NET Core
application.
I have a public
method as shown below which has two private methods.
public bool CallService(JObject requestJsonObj, out Status status)
{
bool provisioningSuccess = false;
var preProcessSuccess = PreProcessing(requestJsonObj,out Status status);
var postProcessSuccess = PostProcessing(requestJsonObj,out Status status);
if(preProcessSuccess && postProcessSuccess)
{
status = Status.ProvisionSuccess;
provisioningSuccess = true;
}
return provisioningSuccess;
}
Here is Status and private classes
public enum Status
{
[Description("User/Pwd not valid")]
CredentialInvalid = 111,
[Description("Provision is success")]
ProvisionSuccess = 112,
}
private PreProcessing(JObject JosnObj,
out Status status)
{
using (var client = new HttpClient())
{
var request = new {.........};
var response = client.PostAsJsonAsync("api/preprocess", request).Result;
}
}
private PostProcessing(JObject JosnObj,
out Status status)
{
//.....
}
Tried the below way,
PrivateObject privateHelperObject = new PrivateObject(typeof(MainService));
actual = (bool)privateHelperObject.Invoke("CallService", requestJsonObj,status);
It says
The type or namespace name "PrivateObject" could not be found (are you missing a using directive or an assembly reference?)
This is a .NET CORE project. I am not sure if PrivateObject
is supported .net core?