How to Mock another method of same class we are testing in c# without dependency injection
I am facing one scenario where I need to mock another method of the same class in c#. But I am facing issue to mock another method and the same I am sharing below.
Interface -->
public interface IFetch
{
string GetColorCodes();
string FetchData();
}
Class-->
public class Fetch : IFetch
{
public Fetch()
{
//I dont have any dependency injection
}
public string GetColorCodes() {
return "Yellow";
}
public string FetchData(){
string color= GetColorCodes();
return color;
}
Now, while creating a unit test for testing FetchData() method I don't want it should internally call GetColorCodes() method and returns "Yellow". I want to return some other color like "Red". Since there is no dependency and method is in the same class I am not able to find out the way. If anyone has an idea please share with this sample code
[TestFixture]
class FetchTest
{
[Test]
public void FetchDataTest()
{
Fetch obj=new Fetch();
string color= obj.FetchData();
Assert.IsEquals(color,"Red")
}
}
I want to mock the GetColorCodes() method from the test to Return Red color.
2 answers
-
answered 2019-11-14 05:18
Michael Kokorin
FetchData method doesn't have any dependencies here. You can't mock part of class to test another part of class. You need to introduce some dependency here, e.g. like this:
public interface IColorProvider { string GetColor(); } public class DefaultColorProvider : IColorProvider { public string GetColor => "Yellow"; } public class Fetch : IFetch { private readonly IColorProvider _colorProvider; public Fetch(IColorProvider colorProvider) { _colorProvider = colorProvider } public string FetchData(){ string color= _colorProvider.GetColor() return color; }
In this case - you have clear dependency and you can mock behavior of IColorProvider and test behavior of FetchData.
UPDATE: You can do something like this:
public class Fetch : IFetch { private readonly IColorProvider _colorProvider; public Fetch(IColorProvider colorProvider) { _colorProvider = colorProvider } public string GetColorCodes() { return _colorProvider.GetColor(); } public string FetchData(){ string color= GetColorCodes(); return color; }
So changes in the class will be very small but it will give you ability to test this.
-
answered 2019-11-14 05:36
CRice
If you have no problems with making
GetColorCodes()
virtual then you can use the Extract and Override test pattern. In your test, new up FetchStub with the mock value you wish to use and call your method under test FetchData from the same instance:public class FetchStub : Fetch { private readonly string _colorCode; public FetchStub(string colorCode) { _colorCode = colorCode; } public override string GetColorCodes() { return _colorCode; } } public class Fetch { public Fetch() { //I dont have any dependency injection } public virtual string GetColorCodes() { return "Yellow"; } public string FetchData() { string color = GetColorCodes(); return color; } }
See also questions close to this topic
-
Docker how to deploy dotnet nginx ? (without .csproj)
Hello I want to deploy in docker: .net, kestrel and nginx. I have a project assembly without .csproj (it is possible or need .csproj ?) But when I try to deploy my .net project in Docker I had status Exitet.
Dockerfile
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env
WORKDIR /app
COPY . .
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
WORKDIR /app
COPY . .
EXPOSE 80
ENTRYPOINT ["bash"]
CMD ["build1", "WebApplication4.dll"]
My project files
appsettings.Development.json
appsettings.json
Dockerfile
WebApplication4
WebApplication4.deps.json
WebApplication4.dll
WebApplication4.pdb
WebApplication4.runtimeconfig.json
WebApplication4.Views.dll
WebApplication4.Views.pdb
web.config
wwwroot
docker ps --all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0f1880a89999 build1 "bash build1 WebAppl…" 4 seconds ago Exited (127) 3 seconds ago sleepy_bardeen
-
How to stop TabbedPage icon from shifting up when it is selected
I'm trying to build a navigation bar with that has 5 icons on it (each for its own page). The issue that I'm currently having is that whenever I click on one of the icons it moves it up a bit (sort of a pop up) while you have that page selected. I know it's probably some sort of property that has to be set to false but I don't know exactly which. Any help would be appreciated, thanks.
XAML code for MainPage.xaml :
<?xml version="1.0" encoding="utf-8" ?> <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:views="clr-namespace:StudioDen.View" mc:Ignorable="d" x:Class="StudioDen.MainPage" BarBackgroundColor="#FFDA00" UnselectedTabColor="Black" SelectedTabColor="Black"> <!--The last three properties set the colours of the bar to yellow and the icons to black--> <!--Projects view on the tabbed page--> <NavigationPage IconImageSource="ic_projects.png" > <x:Arguments> <views:Projects /> </x:Arguments> </NavigationPage> <!--Events view on the tabbed page--> <NavigationPage IconImageSource="ic_events.png" > <x:Arguments> <views:Events/> </x:Arguments> </NavigationPage> <!--Upload view on the tabbed page--> <NavigationPage IconImageSource="ic_uploadV2.png" > <x:Arguments> <views:Upload/> </x:Arguments> </NavigationPage> <!--Process view on the tabbed page--> <NavigationPage IconImageSource="ic_processV3.png" > <x:Arguments> <views:Process /> </x:Arguments> </NavigationPage> <!--Login view on the tabbed page--> <NavigationPage IconImageSource="ic_loginV2.png" > <x:Arguments> <views:Login /> </x:Arguments> </NavigationPage> </TabbedPage>
-
C# GMap: How to draw a 120 degree beam angle on a map
how can I add a polygon to the map as in the picture below? From a certain point of coordinates should open a polygon long, for example, 1 kilometer and a 120-degree opening angle.
https://i.ibb.co/ZLKgvJs/image.png
private void CreateCircle(Double lat, Double lon, double radius, int ColorIndex) { GMapOverlay markers = new GMapOverlay(mygmap, "markers"); PointLatLng point = new PointLatLng(lat, lon); int segments = 1080; List<PointLatLng> gpollist = new List<PointLatLng>(); for (int i = 0; i < segments; i++) { gpollist.Add(FindPointAtDistanceFrom(point, i * (Math.PI / 180), radius / 1000)); } GMapPolygon polygon = new GMapPolygon(gpollist, "Circle"); switch (ColorIndex) { case 1: polygon.Fill = new SolidBrush(Color.FromArgb(80, Color.Red)); break; case 2: polygon.Fill = new SolidBrush(Color.FromArgb(80, Color.Orange)); break; case 3: polygon.Fill = new SolidBrush(Color.FromArgb(20, Color.Aqua)); break; default: MessageBox.Show("No search zone found!"); break; } polygon.Stroke = new Pen(Color.Red, 1); markers.Polygons.Add(polygon); mygmap.Overlays.Add(markers); } public static GMap.NET.PointLatLng FindPointAtDistanceFrom(GMap.NET.PointLatLng startPoint, double initialBearingRadians, double distanceKilometres) { const double radiusEarthKilometres = 6371.01; var distRatio = distanceKilometres / radiusEarthKilometres; var distRatioSine = Math.Sin(distRatio); var distRatioCosine = Math.Cos(distRatio); var startLatRad = DegreesToRadians(startPoint.Lat); var startLonRad = DegreesToRadians(startPoint.Lng); var startLatCos = Math.Cos(startLatRad); var startLatSin = Math.Sin(startLatRad); var endLatRads = Math.Asin((startLatSin * distRatioCosine) + (startLatCos * distRatioSine * Math.Cos(initialBearingRadians))); var endLonRads = startLonRad + Math.Atan2(Math.Sin(initialBearingRadians) * distRatioSine * startLatCos, distRatioCosine - startLatSin * Math.Sin(endLatRads)); return new GMap.NET.PointLatLng(RadiansToDegrees(endLatRads), RadiansToDegrees(endLonRads)); } public static double DegreesToRadians(double degrees) { const double degToRadFactor = Math.PI / 180; return degrees * degToRadFactor; } public static double RadiansToDegrees(double radians) { const double radToDegFactor = 180 / Math.PI; return radians * radToDegFactor; }
My code can only draw a circle. Can it be changed so that it can draw a polygon from a certain point of coordinates with an indication of the direction, distance of drawing and the angle of aperture?
-
Push to a POST API using Pub/Sub
I'm setting up Pub/Sub for my
Android Management API
solution, I have created aTopic
&Subscription
to create aENROLLMENT
notification. The subscription is of typePULL
so when I pull it works as expected and shows the enrollment notifications.I want to use
Delivery type
asPUSH
and hit aPOST API
which will add the details of this newly enrolled device into my DB. Can I use thePOST API URL
something likehttps://abc.dcd.com:8008/api/PubTest
as theEndpoint URL
? If so how can I test it using debugger ?I was unable to find any tutorial in C# to do the same.
Thanks in advance!
-
Does it make sense to develop with web forms?
I start with a new project in my company...
I developed with .net core and it is very powerful but I think it is slower for development, especially for the creation of the user inteface
I think to develop with web forms because they have the component that simplify the creation of the user interface and so I can be faster in development.
Does it make sense to develop with web forms? In business contexts where you need to create line-of-business web applications.
Microsoft continue to develop this tecnology or will create a new way to quickly create UI ?
Can you give me some suggestions?
BR
-
LiveData Observer not working in Android Unit Test
I am using retrofit repository pattern with LiveData in the app. It is working fine in my source code. But I am unable to use it in test. I am always getting LOADING state only.
Expected result : - It should go to success or error after loading
class ApiTest { @get:Rule val instantTaskExecutorRule = InstantTaskExecutorRule() @Test fun doLoginRepository_positiveResponse() { val loginRepository = LoginRepository(ServiceGenerator.createService(APIService::class.java)) loginRepository.doLogin("9876543210", "admin123").observeForever { when(it.status) { Resource.Status.LOADING -> { //assert(false) } Resource.Status.SUCCESS -> { //assertEquals(Resource.Status.SUCCESS, it.status) assert(true) } Resource.Status.ERROR -> { assert(false) } } } } }
-
How do i create a mock for this Role Service
Role Service is part of our Application. I am not able to use this service as I am not able to mock BehaviourSubjects
import { Injectable } from '@angular/core'; import { ConstantService } from '../../services/constant/constant.service'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; @Injectable() export class RoleService { constants; // Variable to hold the constant JSON in asset folder constructor(private constantService: ConstantService) { this.constants = this.constantService.constantJson(); } private isSiteAdmin = new BehaviorSubject<boolean>(null); public isSiteAdmin$ = this.isSiteAdmin.asObservable(); private isPolicyApprover = new BehaviorSubject<boolean>(null); public isPolicyApprover$ = this.isPolicyApprover.asObservable(); private isFtpApprover = new BehaviorSubject<boolean>(null); public isFtpApprover$ = this.isFtpApprover.asObservable(); resetRoles() { this.isSiteAdmin.next(false); this.isPolicyApprover.next(false); this.isFtpApprover.next(false); } setUserRoles() { this.resetRoles(); const roleList = this.constants.Roles; let userDetails; if (localStorage.getItem('currentUser') !== undefined) { userDetails = JSON.parse(localStorage.getItem('currentUser')); } if (userDetails.Roles.length > 0) { userDetails.Roles.forEach(role => { switch (role.RoleId) { case roleList.site_admin: this.isSiteAdmin.next(true); break; case roleList.policy_approver: this.isPolicyApprover.next(true); break; case roleList.ftp_approver: this.isFtpApprover.next(true); break; default: this.isUser.next(true); } }); } } }
It reports a error Failed: roleService.isSiteAdmin$ is undefined How do I create a mock for this Service so that i can use it in components
SPEC FILE of MAIN PAGE COMPONENT
let component: MainPageComponent; let fixture: ComponentFixture<MainPageComponent>; fdescribe('MainPageComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ MainPageComponent, ControlLabelComponent, ControlTextboxComponent, ControlTextEditorComponent, ControlDropdownComponent, ControlUploadComponent, ControlImageViewerComponent, ControlHeaderComponent, ControlSubHeaderComponent, ControlMultilineBoxComponent, ControlExternalLinkerComponent, ControlLinkRepeaterComponent, ControlSyncAssociationComponent, ControlActorSubheaderComponent, LockContextComponent, ], providers: [ { provide: Http, deps: [MockBackend] }, { provide: ConstantService, useClass: ConstantServiceMock }, { provide: LeftPanelService, useClass: ConstantServiceMock }, { provide: RoleService, useClass: RoleServiceMock }, { provide: MenuService, useClass: MenuService }, ], imports: [ HttpClientModule, RouterTestingModule, FormsModule, ModalModule.forRoot() ], schemas: [ NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA ] }).compileComponents(); })); beforeEach(async(() => { fixture = TestBed.createComponent(MainPageComponent); component = fixture.componentInstance; })); it('should create the app', () => { // component.constants.environment.production = true; expect(component).toBeTruthy(); });
Same it is again saying roleService.isSiteAdmin$ is undefined.
ADDED TS FILE for better understanding
import { Component, OnInit, ViewChild } from '@angular/core'; import { ConstantService } from '../../services/constant/constant.service'; import { LeftPanelService } from '../../services/left-panel/left-panel.service'; import { RoleService } from '../../services/role/role.service'; import { MenuService } from '../../services/menu/menu.service'; @Component({ selector: 'main-page', templateUrl: './main-page.component.html', styleUrls: ['./main-page.component.css'] }) export class MainPageComponent implements OnInit { //#region VARIABLES //#region Role Variables isSiteAdmin; isUser; isEditor; isProjectApprover; isAdmin; isUsecaseApprover; isActorApprover; isScenarioApprover; isPolicyApprover; isFtpApprover; isOtherMenuOptionDisabled; //#endregion messages; // Variable to hold the message JSON in asset folder constants; // Variable to hold the constant JSON in asset folder successPopupMessage: string; // used to show success message @ViewChild('successPopup') successPopup; errorPopupMessage: string; // used to show error message @ViewChild('errorPopup') errorPopup; @ViewChild('rightPanel') rightPanel; @ViewChild('whoApproved') whoApprovedPopup; @ViewChild('lockedInEditViewChild') lockedInEditViewChild; mainPageMenu; whoApprovedData; whoApprovedModalPopup; lockedInEditDataString: string; lockedInEditDataModalPopup; //#endregion //#region Constructor constructor(private constantService: ConstantService, private leftPanelService: LeftPanelService, public roleService: RoleService, private menuService: MenuService) { this.messages = this.constantService.messageJson(); this.constants = this.constantService.constantJson(); // get options menuService.mainPageMenu$.subscribe(menu => { this.mainPageMenu = menu; }); // set the roles - added in the mail page constructor so that the values are available even if the page is refreshed this.roleService.setUserRoles(); // set options this.menuService.setMainMenuOption(); this.initializeMainPageMenu(); // check site admin roleService.isSiteAdmin$.subscribe(isSiteAdmin => { this.isSiteAdmin = isSiteAdmin; }); // check editor roleService.isEditor$.subscribe(isEditor => { this.isEditor = isEditor; }); // check isUser roleService.isUser$.subscribe(isUser => { this.isUser = isUser; }); // check isProjectApprover roleService.isProjectApprover$.subscribe(isProjectApprover => { this.isProjectApprover = isProjectApprover; }); // check isUsecaseApprover roleService.isUsecaseApprover$.subscribe(isUsecaseApprover => { this.isUsecaseApprover = isUsecaseApprover; }); // check isActorApprover roleService.isActorApprover$.subscribe(isActorApprover => { this.isActorApprover = isActorApprover; }); // check isScenarioApprover roleService.isScenarioApprover$.subscribe(isScenarioApprover => { this.isScenarioApprover = isScenarioApprover; }); // check isPolicyApprover roleService.isPolicyApprover$.subscribe(isPolicyApprover => { this.isPolicyApprover = isPolicyApprover; }); // check isFtpApprover roleService.isFtpApprover$.subscribe(isFtpApprover => { this.isFtpApprover = isFtpApprover; }); // check isAdmin roleService.isAdmin$.subscribe(isAdmin => { this.isAdmin = isAdmin; }); this.disableOtherMenuOption(); this.disableMenuForRoles(); // who approved Modal Pop Up this.whoApprovedModalPopup = { whoApprovedModal: false, title: this.messages.LockPopup.WhoApproved, footerButtons: [ { Text: 'Ok', event: 'ok', cssClass: 'footer-modal-popup-ok' }, ], }; // lock timeout Modal Pop Up this.lockedInEditDataModalPopup = { lockedInEditDataModal: false, title: this.messages.LockPopup.LockedInEditDetails, footerButtons: [ { Text: 'Ok', event: 'ok', cssClass: 'footer-modal-popup-ok' }, ], }; } disableOtherMenuOption() { if (this.isSiteAdmin || this.isEditor) { this.isOtherMenuOptionDisabled = false; } else if (this.isUser || this.isProjectApprover || this.isScenarioApprover || this.isActorApprover || this.isUsecaseApprover || this.isPolicyApprover || this.isFtpApprover || this.isAdmin) { this.isOtherMenuOptionDisabled = true; } } //#endregion /** * Method to initialize Main Page Menu Options */ initializeMainPageMenu() { // this.mainPageMenu = this.menuService.getMainPageMenu(); /** * Method to disable all the remaining options other than view and create from FrameObject Menu */ this.leftPanelService.getCurrentFrameObjType().subscribe(type => { this.mainPageMenu.dropdowns.forEach(dropDown => { if (dropDown.type !== type) { dropDown.options.forEach(option => { if (this.isOtherMenuOptionDisabled) { this.disabledExceptViewFrameObj(option); } else { if (option.key.indexOf('view') > -1 || option.key.indexOf('create') > -1) { option.isDisabled = false; } else { option.isDisabled = true; } } }); } else { dropDown.options.forEach(option => { if (this.isOtherMenuOptionDisabled) { this.disabledExceptViewFrameObj(option); } else { option.isDisabled = false; } }); } }); }); } disabledExceptViewFrameObj(option) { if (option.key.indexOf('view') > -1) { option.isDisabled = false; } else { option.isDisabled = true; } } disableMenuForRoles() { this.mainPageMenu.dropdowns.forEach(dropDown => { dropDown.options.forEach(option => { if (option.key.indexOf('view') > -1) { option.isDisabled = false; } else { if (this.isUser) { option.isDisabled = true; } } }); }); } //#endregion //#region Init ngOnInit() { } //#endregion /** * Method to hide the who approved pop up */ okWhoApprovedModalPopup() { this.whoApprovedPopup.hide(); } /** * Method to hide the lock time out pop up */ okLockedInEditDataModalPopup() { this.lockedInEditViewChild.hide(); } }
In our application most of the places role services is used. So if one page is solved..other will become easy. Please look into it
-
How to do mock a post request in python so that it can accept different input values and return different values based on the input?
This is the original post request
result = requests.post('api/' + tenant_name + '/getdomain', json=query_to_execute, verify=False,timeout=100) json_result = result.json()x
here the query to execute will be aggregate mongodb query of the format
[{$match: {}}, {$limit:25}]
Now I already have a unittest case class
def mock_another_post_request(arg): ret_values=[ [ { "name":"Abcd",'Age':25}, { "name":"asfcd",'Age':45},], [{ "name":"sdfd",'Age':42},] ] return ret_values[arg] class MyTests (unittest.TestCase): def setup(self): patcher = patch('requests.post',new = mock_another_post_request) patcher.start() self.addCleanup(patch.stopall) def MyTestCase(): expected_result =[ { "name":"Abcd",'Age':25}, { "name":"asfcd",'Age':45},] assertEqual expected_result = get_all_docs()
I am very confused on what I am doing , the goal is to mock requests.post and based on the inputs send as part of the payload I should be able to return different values, how do I do that? Thanks in advance.
-
How to know the gradle process has ended?
I want to get the gradle running process where I can come to know that gradle task has ended. I am executing gradle tasks parallel in my machines like following.
in Windows,
start gradlew runSuite1 -i --rerun-tasks start gradlew runSuite1 -i --rerun-tasks
in Mac,
./gradlew runSuite1 -i --rerun-tasks & ./gradlew runSuite2 -i --rerun-tasks &
It will trigger all gradle operations in parallel.
I want to perform one operation once all this gradle tasks are ended.
How to know these gradle running process using java or anything ?
Thanks in advance
-
How to replace value of any specific key through shell script
I need to replace some value of configmap.yaml and I have to automate it through shell script. How to do this?
In my case, some line of config.YAML file is
"ABC_KEY" : "*******"
While I am automating the total installation process, it got stuck with an error:
error: error parsing yamlfiles/configMap.yaml: error converting YAML to JSON: yaml: line 22: did not find the expected key"
What I want while I run the shell script to automate the installation process and it applies the config.YAML file, is that it asks me some value of the specific key and I will manually enter the value. Then it should run and complete the automation of installation process
Input YAML file:
SECRET_KEY: "******"" JWT_KEY: "********" SFTP_PWD: "*********"
In the shell script I am executing this command:
kubectl apply -f yamlfiles/configMap.yaml
After running the kubectl command, I want it to ask me the value of those keys so that I can manually enter the value then the apply of configmap will be fulfilled. Is it possible?
-
Can we extract files (excel) from a website through vba, tableau or sas
Since, it's a recurring task and we need to extract files/reports from a particular website - wanted to understand if there is a way if we can automate this. The website is internal and requires login.
-
C# Unit Testing - Moq - Mocked Method always return Null instead of specified return value
I am trying to Mock a function call within a Method which I am Unit Testing. But the Mocked Function is always returning null. In this case,
DoPost
is always returning null, despite the fact that in the Mock object I am setting it up to return a custom value.Below are
MyApi
Class which ContainAction1()
method, which I am unit testing.Action1()
method internally callsDoPost()
method, which I am Mocking to return a specific value, but returning null. This is the issue I am facing.What am I doing wrong here?
// Class and Method to be Unit Tested public class MyApi { NetClient netClient = null; // Constructor public MyApi(NetClient client) { netClient = client; } public MyCustomClass Action1() { var result = netClient.DoPost("val1", "val2"); } } // Class which has the Mocked Function public class NetClient() { public virtual string DoPOST(string url, string data) { // Processing Code } } // Unit Test public void Action1_Success() { // arrange var expected = "abc"; var mock = new Mock<NetClient>(); mock.Setup(s => s.DoPOST(It.IsAny<string>(), It.IsAny<string>())).Returns(expected); var api = new MyApi(mock.Object); // act var result = api.Action1(); // assert Assert.AreEqual(expected, "abc"); }
-
How to mock ExceptionContext for testing using .NET Core 3 Web API and Moq
In order to properly test a custom ExceptionFilterAttribute in .NET Core 3 we need to mock an ExceptionContext in an Xunit test using Moq. How can I do this?
Exception Filter:
public class CustomExceptionFilter : ExceptionFilterAttribute { public override OnException(ExceptionContext context) { /* Code here that handles exceptions */ } }
I've looked everywhere and can't figure out a good way to mock these things in a way that ensures nothing throws an exception due to other missing dependencies. How can I mock
ExceptionContext
easily? -
How can I setup IHttpClientAdapter.GetAsync to return a HttpResponseMessage with particular value for IsSuccessStatusCode?
I have a class that has a dependency on the
IHttpClientAdapter
, which I am using to call a RESTful API.I have a test for the method that uses the dependency, so I am mocking the
IHttpClientAdapter
usingMoq
. The test should check that when theGetAsync
method returns any unsuccessful response, something happens.One thing that I could do is create a new
HttpResponseMessage
like so:var response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError };
Then setup the mocked dependency to return that like so:
_httpClientAdapterMock.Setup(x => x.GetAsync(new Uri("http://someuri"))).ReturnsAsync(response);
IsSuccessfulStatusCode
in this case would evaluate to false, so the test passes as one would expect.However, this test is not as robust as I'd like it to be, as it only checks one particular response code. What I would really like to do is set the
IsSuccessfulStatusCode
to false instead. So something like this:var response = new HttpResponseMessage { IsSuccessStatusCode = false // cannot do this, as IsSuccessStatusCode is readonly };
I have tried extending the
HttpResponseMessage
(namedFakeHttpResponseMessage
), creating an instance of that class and setting theIsSuccessStatusCode
property to true, and then setup the mock to return that instead, but theIsSuccessStatusCode
property evaluates totrue
when running the test, so it didn't have the desired effect.How can this be achieved, without having to test each and every possible unsuccessful
HttpStatusCode
?