Giter Club home page Giter Club logo

xania.aspnet's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

xania.aspnet's Issues

ArgumentNullException occured if mock DependencyResolver is used

I tried to use Xania.AspNet.Simulator for Authorize attribute testing. I added this library to my existing unit test project and wrote such test:

    [TestMethod]
    public void HomeControllerAuthorizeTest()
    {
        var ctrl = new HomeController();

        var action = ctrl.Action("Index");
        action.Authenticate("user", new[] { "User" });

        var result = action.GetAuthorizationResult();

        Assert.IsNull(result);
    }

And ArgumentNullException occured on action.GetAuthorizationResult(). I was amazed, this test is almost the same as examples in repo, but it didn't work! Then, I found a difference: a test class with this test method (as all controller test classes in my project) sets mock DependencyResolver on initialize:

[TestInitialize]
public void Setup()
{
    var mockResolver = MockRepository.GenerateMock<IDependencyResolver>();
    ...
    DependencyResolver.SetResolver(_mockResolver);
}

I tried to comment SetResolver line, and a test began to work.

If it is a bug, please fix it. Or, if I do something wrong, give an example with GetAuthorizationResult and mock DependencyResolver both.

Calling action with filters

Hi @ibrahimbensalah. Really interested in this project. Could you provide an example of how I can execute a controller action that has filters on it? For example, I have a LoggingFilter that has been added to GlobalFilters. I'm interested in executing the whole pipeline, with filters, binders, etc.

Thanks

Duplicate assembly issue with ReSharper

Hi

When I run my NUnit tests with the ReSharper test runner, Simulator is throwing an exception in the Assemblies property of MvcApplication, line 145:

System.ArgumentException : An item with the same key has already been added.

The Linq query on AppDomain.CurrentDomain.GetAssemblies() is returning duplicates, hence the error with duplicate key names being added to the collection. In my test project, this is the particular assembly that has been returned multiple times - JetBrains.ReSharper.UnitTestRunner.nUnit30.dll. Maybe a Distinct() call at the end of the query would resolve it?

When I run the tests with TestDriven.Net the error does not occur, presumably because the ReSharper DLLs are not loaded into the AppDomain.

Documentation

Hi :)

I'm really keen to explore the features of this library, but it's a little tricky to get started without some documentation. I've had a look at some of the tests, but I'm struggling a bit to understand how view rendering works.

As an example: I'm getting some Razor compilation errors since it can't seem to find some of the dlls even though they are loaded into my app and I'm not sure what method this library uses for finding and loading assemblies.

Thanks

System.Web.HttpException: View 'viewname' not found

Created new MVC project from VS wizard (index page with About, Contact etc.) and test project alongside. Included Xania.AspNet nuget and wrote this:

[TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            var controller = new HomeController();
            var action = controller.Action(c => c.About());
            var result = action.Execute();
            Console.WriteLine(result.ToString());
        }
    }

it falls on action.Execute with System.Web.HttpException: View 'About' not found.
Is that normal and what I must to do?

.NET 4.7.2, MVC5

Support for WebApi other than Mvc

Hi, could it be possible to include the extension?

.Action(controller => controller.Method())

support for WebApi also?

I see it works for MVC (System.Web.Mvc) - Controller
but not for WebApi (System.Web.Http) - ApiController

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.