Click here to Skip to main content
14,576,731 members

.NET (Core and Framework)

 
AnswerRe: 阿萨德群无若群无若无群若 Pin
Richard Andrew x6421-Apr-19 7:32
professionalRichard Andrew x6421-Apr-19 7:32 
QuestionPassing Value from XAML to ViewModel Pin
Jassim Rahma20-Apr-19 13:45
MemberJassim Rahma20-Apr-19 13:45 
AnswerRe: Passing Value from XAML to ViewModel Pin
Gerry Schmitz21-Apr-19 5:56
mveGerry Schmitz21-Apr-19 5:56 
QuestionWriting unit tests for two methods of the same Service are being called in one method: FluentAssertions Pin
simpledeveloper19-Apr-19 14:32
Membersimpledeveloper19-Apr-19 14:32 
AnswerRe: Writing unit tests for two methods of the same Service are being called in one method: FluentAssertions Pin
Gerry Schmitz21-Apr-19 6:08
mveGerry Schmitz21-Apr-19 6:08 
GeneralRe: Writing unit tests for two methods of the same Service are being called in one method: FluentAssertions Pin
simpledeveloper21-Apr-19 16:58
Membersimpledeveloper21-Apr-19 16:58 
GeneralRe: Writing unit tests for two methods of the same Service are being called in one method: FluentAssertions Pin
Gerry Schmitz22-Apr-19 4:36
mveGerry Schmitz22-Apr-19 4:36 
GeneralRe: Writing unit tests for two methods of the same Service are being called in one method: FluentAssertions Pin
simpledeveloper22-Apr-19 7:07
Membersimpledeveloper22-Apr-19 7:07 
Where in the Unit Test or in the actual method? From the Actual method I have to use the ApplicationException, even though, I just want to at least throw some Exception from my Unit Test call, but no Exception is being thrown, there is very less help from Online, it seems complicated any help would be very helpful brother rather than giving me high level help.

And I am getting the following error in the Unit Test:
Assert.ThrowsException failed. No exception thrown. Exception exception was expected. 
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at CustomerServiceWeb.Library.Test.Registration.RegistrationManagerTest.<RegisterOnlineAccountAsync_ExceptionTest>d__18.MoveNext() in C:\SourceCode\FlexPricing\CustomerServiceWeb.Library.Test\Registration\RegistrationManagerTest.cs:line 692
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Basically Unit test is failing because the Method is not throwing Exception, let it be any Exception, I want to just throw an Exception

I did change it as you said removed the ApplicationException, but still the Unit test is failing:
private async Task<bool> CreateUserOnlineAccountAsync(OnlineRegistration registration)
{
    try
    {
        var request = new CreateUserAccountRequest
        {
            Description = $"Account created: {DateTime.Now:MM/dd/yyyy}",
            AccountType = registration.IsResidential ? nameof(OnlineAccountType.PGEResidentialAcct) : nameof(OnlineAccountType.PGECommercialAcct),
            PersonId = registration.PersonId,
            Password = registration.Password,
            UserName = registration.EmailAddress,
            CcbAccountId = registration.AccountNumber,
            BusinessPersonId = !registration.IsResidential ? registration.MainPersonId : null
        };

        return await this._pgeAuthAdminProxy.CreateUserAccountAsync(request).ConfigureAwait(false);
    }
    catch (Exception ex)
    {
        throw new Exception("My test blew up as expected");
    }
}


modified 22-Apr-19 13:40pm.

GeneralRe: Writing unit tests for two methods of the same Service are being called in one method: FluentAssertions Pin
Gerry Schmitz22-Apr-19 8:28
mveGerry Schmitz22-Apr-19 8:28 
GeneralRe: Writing unit tests for two methods of the same Service are being called in one method: FluentAssertions Pin
simpledeveloper22-Apr-19 8:55
Membersimpledeveloper22-Apr-19 8:55 
Question“Collection was modified; enumeration operation might not execute” inside System.Data.TypedTableBase<> Pin
VictorSotnikov9-Apr-19 5:52
MemberVictorSotnikov9-Apr-19 5:52 
AnswerRe: “Collection was modified; enumeration operation might not execute” inside System.Data.TypedTableBase<> Pin
Gerry Schmitz9-Apr-19 6:15
mveGerry Schmitz9-Apr-19 6:15 
GeneralRe: “Collection was modified; enumeration operation might not execute” inside System.Data.TypedTableBase<> Pin
VictorSotnikov9-Apr-19 6:28
MemberVictorSotnikov9-Apr-19 6:28 
GeneralRe: “Collection was modified; enumeration operation might not execute” inside System.Data.TypedTableBase<> Pin
Gerry Schmitz10-Apr-19 5:39
mveGerry Schmitz10-Apr-19 5:39 
GeneralRe: “Collection was modified; enumeration operation might not execute” inside System.Data.TypedTableBase<> Pin
David A. Gray3-May-19 7:33
MemberDavid A. Gray3-May-19 7:33 
GeneralRe: “Collection was modified; enumeration operation might not execute” inside System.Data.TypedTableBase<> Pin
Gerry Schmitz3-May-19 8:48
mveGerry Schmitz3-May-19 8:48 
Questionregarding the cryptarithmatic code in your website Pin
Member 141248901-Apr-19 4:32
MemberMember 141248901-Apr-19 4:32 
AnswerRe: regarding the cryptarithmatic code in your website Pin
Richard MacCutchan1-Apr-19 4:42
mveRichard MacCutchan1-Apr-19 4:42 
QuestionIs there any way to initialize or set values for this declaration as inline statement private IList<MockData<OnlineRegistration, OnlineRegistration, OnlineRegistration>> _registerMocks; Pin
simpledeveloper28-Mar-19 7:18
Membersimpledeveloper28-Mar-19 7:18 
AnswerRe: Is there any way to initialize or set values for this declaration as inline statement private IList<MockData<OnlineRegistration, OnlineRegistration, OnlineRegistration>> _registerMocks; Pin
Eddy Vluggen29-Mar-19 2:33
professionalEddy Vluggen29-Mar-19 2:33 
QuestionASP.Net 4.5 to ASP.Net core 2.0.1 migration issue of Authentication Pin
geetha naidu24-Mar-19 11:38
Membergeetha naidu24-Mar-19 11:38 
AnswerRe: Data Science with Python environment setup Pin
Gerry Schmitz8-Mar-19 9:23
mveGerry Schmitz8-Mar-19 9:23 
GeneralRe: Data Science with Python environment setup Pin
Richard MacCutchan8-Mar-19 22:10
mveRichard MacCutchan8-Mar-19 22:10 
GeneralRe: Data Science with Python environment setup Pin
Gerry Schmitz9-Mar-19 3:04
mveGerry Schmitz9-Mar-19 3:04 
QuestionWPF DataGridComboBoxColumn Binding Issue Pin
Saved By Grace28-Feb-19 4:47
MemberSaved By Grace28-Feb-19 4:47 

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.