Click here to Skip to main content
15,915,513 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: WPF DataGridComboBoxColumn Binding Issue Pin
Gerry Schmitz28-Feb-19 10:59
mveGerry Schmitz28-Feb-19 10:59 
AnswerRe: WPF DataGridComboBoxColumn Binding Issue Pin
Saved By Grace28-Feb-19 15:06
Saved By Grace28-Feb-19 15:06 
GeneralRe: WPF DataGridComboBoxColumn Binding Issue Pin
Saved By Grace1-Mar-19 9:11
Saved By Grace1-Mar-19 9:11 
SuggestionRe: WPF DataGridComboBoxColumn Binding Issue Pin
FLYFLU20-Mar-19 15:30
FLYFLU20-Mar-19 15:30 
QuestionCOM Interop with latest .NET Framework Pin
JackMisani19-Feb-19 0:19
JackMisani19-Feb-19 0:19 
AnswerRe: COM Interop with latest .NET Framework Pin
Gerry Schmitz19-Feb-19 5:54
mveGerry Schmitz19-Feb-19 5:54 
GeneralRe: COM Interop with latest .NET Framework Pin
JackMisani19-Feb-19 6:29
JackMisani19-Feb-19 6:29 
QuestionMSIL: Are there practical uses for writing MSIL code that can't be done in C# Pin
nrnoble18-Feb-19 0:29
nrnoble18-Feb-19 0:29 
AnswerRe: MSIL: Are there practical uses for writing MSIL code that can't be done in C# Pin
Richard Deeming18-Feb-19 1:19
mveRichard Deeming18-Feb-19 1:19 
QuestionTask based asyn Pin
anilkumar198612-Feb-19 18:50
anilkumar198612-Feb-19 18:50 
AnswerRe: Task based asyn Pin
Wastedtalent12-Feb-19 21:21
professionalWastedtalent12-Feb-19 21:21 
GeneralRe: Task based asyn Pin
anilkumar198612-Feb-19 21:37
anilkumar198612-Feb-19 21:37 
GeneralRe: Task based asyn Pin
Wastedtalent12-Feb-19 21:48
professionalWastedtalent12-Feb-19 21:48 
GeneralRe: Task based asyn Pin
anilkumar198612-Feb-19 22:52
anilkumar198612-Feb-19 22:52 
GeneralRe: Task based asyn Pin
anilkumar198613-Feb-19 1:23
anilkumar198613-Feb-19 1:23 
Questionstatement is not valid n a namespace Pin
Member 1384753912-Feb-19 8:07
Member 1384753912-Feb-19 8:07 
AnswerRe: statement is not valid n a namespace Pin
Richard Deeming12-Feb-19 10:05
mveRichard Deeming12-Feb-19 10:05 
GeneralRe: statement is not valid n a namespace Pin
Member 1384753913-Feb-19 5:37
Member 1384753913-Feb-19 5:37 
QuestionMocking a Service call in my Unit Tests Pin
simpledeveloper8-Feb-19 7:31
simpledeveloper8-Feb-19 7:31 
AnswerRe: Mocking a Service call in my Unit Tests Pin
Gerry Schmitz8-Feb-19 10:46
mveGerry Schmitz8-Feb-19 10:46 
GeneralRe: Mocking a Service call in my Unit Tests Pin
simpledeveloper8-Feb-19 10:59
simpledeveloper8-Feb-19 10:59 
But I am passing args as list to the method that I am going to test but that method loops through each individual item of the list and converts it then calls the service by sending that converted object as an argument.

The problem is how am I going to know the converted object when it is within the scope of the method that I am testing.

You kind of gave me definitely some hint, maybe I am not able to pick it up very well, any code snippet or example link etc, anything helps my friend.

It seems like it is difficult to test these types of Black-box methods (which return void) - and thanks a lot for the support my friend.
One of my Colleague has provided me the below method to do it:
public async Task ServiceAgreementUpdateAddTest()
{
    var expectedServiceRequest1 = new C1ServiceAgreementUpdateRequest();
    var expectedServiceRequest2 = new C1ServiceAgreementUpdateRequest();

    var serviceAgreementCharacteristicRequests = new List<ServiceAgreementCharacteristicRequest>();

    foreach (var serviceAgreementId in this.serviceAgreementIds)
    {
        var request = new ServiceAgreementCharacteristicRequest
        {
            ServiceAgreementId = serviceAgreementId,
            CharacteristicType = characteristicType,
            CharacteristicValue = characteristicValue,
            ActionType = RequestAction.ADD
        };

        serviceAgreementCharacteristicRequests.Add(request);
    }

    this._serviceWrapper.Setup(e => e.UseServiceAsync(It.IsAny<Func<ATC1ServiceAgreementUpdatePortType, Task<C1ServiceAgreementUpdateResponse>>>()))
        .Callback((Func<ATC1ServiceAgreementUpdatePortType, Task<C1ServiceAgreementUpdateResponse>> serviceFunc) => { serviceFunc.Invoke(this._serviceAgreementUdateSvc.Object); })
        .ReturnsAsync(new C1ServiceAgreementUpdateResponse());

    await this._service.ServiceAgreementCharacteristicAsync(serviceAgreementCharacteristicRequests).ConfigureAwait(false);

    this._serviceWrapper.Verify(sw => sw.UseServiceAsync(It.IsAny<Func<ATC1ServiceAgreementUpdatePortType, Task<C1ServiceAgreementUpdateResponse>>>()), Times.Exactly(serviceAgreementCharacteristicRequests.Count));

    this._serviceAgreementUdateSvc.Verify(svc => svc.C1ServiceAgreementUpdateAsync(It.Is<C1ServiceAgreementUpdateRequest>(x =>x.Equals(expectedServiceRequest1))));
    this._serviceAgreementUdateSvc.Verify(svc => svc.C1ServiceAgreementUpdateAsync(It.Is<C1ServiceAgreementUpdateRequest>(x => x.Equals(expectedServiceRequest2))));
}

But when I tried to see by putting the breakpoint there, the inside values or attributes of the expectedServiceRequest1 and expectedServiceRequest2 are coming null, I am not understanding how it is working and what is the fix for it. Any help please? Am I doing any mistake or my colleague has not provided me complete code, its spinning my head - need some help please.

modified 8-Feb-19 18:16pm.

GeneralRe: Mocking a Service call in my Unit Tests Pin
simpledeveloper11-Feb-19 8:29
simpledeveloper11-Feb-19 8:29 
GeneralRe: Mocking a Service call in my Unit Tests Pin
Gerry Schmitz13-Feb-19 5:40
mveGerry Schmitz13-Feb-19 5:40 
QuestionNot able to read the Detail property of Exception, when it is shown in the Quick Watch Pin
simpledeveloper4-Feb-19 12:25
simpledeveloper4-Feb-19 12:25 
AnswerRe: Not able to read the Detail property of Exception, when it is shown in the Quick Watch Pin
Dave Kreskowiak4-Feb-19 14:04
mveDave Kreskowiak4-Feb-19 14:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.