public void IdResolutionGet() { var itemInfo = TestItems.Item(ItemCode.MissileLauncher); var idResolution = new IdResolutionContext(new[] { itemInfo, }); var objRef = new ObjectReference(itemInfo.ObjectId); idResolution.Get<ItemInfo>(objRef); }
public void SupportsNulls() { var idResolution = new IdResolutionContext(Enumerable.Empty<IObject>()); ItemInfo value; idResolution.Get<ItemInfo>(null).ShouldBe(null); idResolution.TryGet(null, out value).ShouldBe(false); }
public void IdResolutionFail() { const long id = 1L; var itemInfo = TestItems.Item(ItemCode.MissileLauncher); var idResolution = new IdResolutionContext(new[] { itemInfo, }); var objRef = new ObjectReference(id); Should.Throw<ItemNotFoundException>(() => idResolution.Get<ItemInfo>(objRef)).Message.ShouldBe("Could not find ItemInfo \"[x00000001]\""); Should.Throw<ItemNotFoundException>(() => idResolution.GetById<ItemInfo>(id)).Message.ShouldBe("Could not find ItemInfo \"1\""); }