public void EntityRenownTaskToDictionary() { int taskId = 101; string objective = "Do something tedious"; int level = 42; Point2D coord = new Point2D(500, 1000); var expected = new Dictionary <string, object>() { { "task_id", taskId }, { "objective", objective }, { "level", level }, { "coord", new Dictionary <string, double>() { { "x", coord.X }, { "y", coord.Y } } }, }; RenownTask task = new RenownTask() { TaskId = taskId, Objective = objective, Level = level, Coordinates = coord, }; var actual = task.ToDictionary(); Assert.AreEqual(expected, actual, "Renown task"); CollectionAssert.AreEquivalent((IDictionary <string, double>)expected["coord"], (IDictionary <string, double>)actual["coord"], "Coords"); }
public void EntitySubregionWithRenownTaskToDictionary() { RenownTask task = new RenownTask() { TaskId = 12 }; Subregion subregion = new Subregion() { Tasks = new List <RenownTask>() { task } }; var expected = task.ToDictionary(); var actualPointOfInterest = (ICollection <object>)subregion.ToDictionary()["tasks"]; var actual = (IDictionary <string, object>)actualPointOfInterest.First(); Assert.AreEqual(expected, actual); }