c# - unit test RaisePropertyChanged -


i need test following code?

   public double loadpercent     {         { return _loadpercent; }         private set         {             raisepropertychanging("loadpercent");             _loadpercent = value;             raisepropertychanged("loadpercent");         }     } 

im using xunit framework , if set not private write test this:

 [fact]  public void loadpercenttest()     {         // arrange          var loader = new loader();         bool notify = false;          // act         loader.propertychanged += (sender, args) =>             {                 if (args.propertyname == "loadpercent")                 {                     notify = true;                 }             };          loader.loadpercent = 20;          // assert         assert.true(notify, "notification failed");     } 

i'm new unit testing (beginner level), appreciated.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -