Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

vb.net - Nunit Assertion for an empty intersection between collection -


i've looked around, , can't quite figure 1 out, , multitude of trial , error attempts have been useless.

i have list of user names (we'll call 'original list') 1 object returning have list of user names (we'll call 'filtration list') object returning

i testing method returns of items original list not in filtration list.

ideally want like

assert.that(returnedlist, has.no.members.in(filtrationlist)) 

so far thing can iterate on filtrationlist , do

assert.that(returnedlist, has.none.equalto(filtereduser)) 

with nunit can create custom constraint. if want verify 2 collections intersection, can create this:

public class intersects : collectionconstraint {     private ienumerable _collection2;      public intersects(ienumerable collection2)         : base(collection2)     {         _collection2 = collection2;     }      public static intersects with(ienumerable arg)     {         return new intersects(arg);     }      protected override bool domatch(ienumerable collection)     {         foreach (object value in collection)         {             foreach (object value2 in _collection2)                 if (value.equals(value2))                     return true;         }          return false;     }      public override void writedescriptionto(messagewriter writer)     {         //you can put here more meaningful items should not in verified collection.         writer.write("intersecting collections");     } } 

usage pretty simple:

string[] returnedlist = new string[] { "martin", "kent", "jack"}; list<string> filteredusers = new list<string>(); filteredusers.add("jack"); filteredusers.add("bob"); assert.that(returnedlist, intersects.with(filteredusers)); 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -