Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

anshul0205

@anshul0205
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Code Refactoring and Dependency Injection C#
    A anshul0205

    For now, to start the refactoring and unit testing, important part is to separate Data access layer from business layer. As you can see,

    [DataObjectMethod(DataObjectMethodType.Select, true)]
    public static WorkQueueBE GetItemByID(int id)
    {
    return WorkQueueDB.GetItemByID(id);
    }

    the code directly calls the dataaccess layer. This makes it untestable. What i want to acheieve is to start testing these methods, and create mock for data access layer so that it can return hardcoded values while testing. But how do i proceed with that ? Create interface, implement them in data access layer ? If anyone can cite an example on how to implement it.

    ASP.NET csharp design testing business beta-testing

  • Code Refactoring and Dependency Injection C#
    A anshul0205

    I have UI call to the businesslayer as,

    BusinessEntity.WorkQueueBE be = BusinessLayer.WorkQueueBEManager.GetItemByID(wqID);

    In the business layer, WorkQueueBEManager class, method is defined as,

    [DataObjectMethod(DataObjectMethodType.Select, true)]
    public static WorkQueueBE GetItemByID(int id)
    {
    return DataAccess.WorkQueueDB.GetItemByID(id);
    }

    In the data access layer, stored proc is called, it fills the WorkQueueBE object and returns the result. I need to write unit tests for this legacy code. I reckon i need to do some refactoring to introduce unit testing here. Can someone please suggest how to move ahead, so that i can make the code loosely coupled.

    ASP.NET csharp design testing business beta-testing
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups