public void GetsObjectsById() { var object1 = new object(); var object2 = new object(); var holder = new UriResolvedObjectHolder(); holder.Add(object1, this._uriResolvedMetadata); holder.Add(object2, this._uriResolvedMetadata); var id1 = holder.GetMetadata(object1).ResolvedId; var id2 = holder.GetMetadata(object2).ResolvedId; Assert.AreEqual(object1, holder.Get(id1)); Assert.AreEqual(object2, holder.Get(id2)); }
public void RaisesExceptionWhenGettingObjectByUnknownId() { var holder = new UriResolvedObjectHolder(); ExceptionAssert.Throws <ArgumentOutOfRangeException>( ex => ex.ParamName == "id", () => holder.Get(9901)); }