Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. [TestMethod]
  2. public void TestGetCountry()
  3. {
  4. string expected = Address.GetCountry();
  5.  
  6. Delegate action = StringGenerators.GetStringGenerator(Enums.StringGenerators.COUNTRY);
  7. string[] args = new string[] { "" };
  8. string actual = (string)action.DynamicInvoke(args);
  9.  
  10. Assert.AreEqual(expected, actual, "Country does not match");
  11. }
  12.  
  13. [TestMethod]
  14. public void TestGetState()
  15. {
  16. string expected = "CA";
  17.  
  18. Delegate action = StringGenerators.GetStringGenerator(Enums.StringGenerators.STATE);
  19. string[] args = new string[] {"CA", "NY"};
  20. string actual = (string)action.DynamicInvoke(args); // exception thrown here
  21.  
  22. Assert.AreEqual(expected, actual, "State does not match");
  23. }
  24.  
  25. public static string GetCountry(object container)
  26. {
  27. return Address.GetCountry();
  28. }
  29.  
  30. public static string GetState(object container)
  31. {
  32. string[] states = (string[])container;
  33. int index = SeedGovernor.GetRandomInt(states.Length);
  34. return states[index];
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement