How to unit test manage a server during postback?

I am trying to create my own EasyBinderDropDown, which currently looks like this:

public class EasyBinderDropDown : DropDownList, ICanBindToObjectsKeyValuePair {
        public void BindToProperties<TYPE_TO_BIND_TO>(IEnumerable<TYPE_TO_BIND_TO>
                  bindableEnumerable,
        Expression<Func<TYPE_TO_BIND_TO, object>> textProperty, 
        Expression<Func<TYPE_TO_BIND_TO, object>> valueProperty) {...}
        public bool ShowSelectionPrompt { get; set; }
        public string SelectionPromptText { get; set; }
        public string SelectionPromptValue { get; set; }
    //...
}

Basically, this is very useful for simple binding to objects from the internal code, since you are just doing something like _dropDown.BindToProperties (myCustomers, c => c.Name, c => c.Id), and it works for you. also setting ShowSelectionPrompt and SelectionPromptText. I can easily get the line "Select customer". I don’t want to ask so much about my specific implementation; rather, I am confused how to write unit tests for some scenarios.

, , , , , . - , ? HTTPContext - , ?

+3
2

" HTTPContext - , ".

"unit test"; " ". , ASP.NET, , , ASP.NET.

HttpContext , - , ​​ Selenium NUnitAsp.

+2

: . IsPostback asp.net. /. , mocks, . , HttpContext, , ( ).

, , asp.net, , . ( ), asp.net. .


:

, . , asp.net.

:

  • , , , unit test
  • , ( watin/selenium rc).
  • , , ( watin/selenium rc).

watin/selenium rc # . , .

Ps. ms asp.net, , .

0

Source: https://habr.com/ru/post/1705212/


All Articles