Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The second call to WithViewData throws NullReferenceException #40

Open
milichev opened this issue Jun 21, 2020 · 1 comment
Open

The second call to WithViewData throws NullReferenceException #40

milichev opened this issue Jun 21, 2020 · 1 comment

Comments

@milichev
Copy link

This code:

            const string pageName = "pageName";

            _sut.GetByPageName(pageName)
                .Should()
                .BeViewResult()
                .WithViewData("PageName", pageName)
                .WithViewData("Roles", _roles) // this call fails!
                .WithViewData("FieldName", null);

causes:

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=FluentAssertions.Mvc5
  StackTrace:
   at FluentAssertions.Mvc.ViewResultBaseAssertions`1.WithViewData(String key, Object expectedValue, String reason, Object[] reasonArgs)
   at Tests.Controllers.HelpEditor.HelpEditorControllerTest.GetByPageName_Should_return_view_for_specified_pageName() in ...\....Tests\Controllers\HelpEditor\HelpEditorControllerTest.cs:line 48

@kevinkuszyk
Copy link
Member

@milichev if you're able to fix, I would gladly take a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants