public void GetsResolvedUriFormUriResolvedObjectHolder() { var resolved = new object(); var metadata = new UriResolvedMetadata(new Uri("tst://tab/module/item"), null); this._uriResolvedObjectHolder.Contains(resolved).Returns(true); this._uriResolvedObjectHolder.GetMetadata(resolved).Returns(metadata); var shell = this.CreateShell(); var uri = shell.GetResolvedUri(resolved); Assert.AreEqual(metadata.Uri, uri); }
public void GetsResolvedIdFormUriResolvedObjectHolder() { var resolved = new object(); var metadata = new UriResolvedMetadata(null, null).AssignId(1334); this._uriResolvedObjectHolder.Contains(resolved).Returns(true); this._uriResolvedObjectHolder.GetMetadata(resolved).Returns(metadata); var shell = this.CreateShell(); var id = shell.GetResolvedId(resolved); Assert.AreEqual(metadata.ResolvedId, id); }
public void UpdatesResolvedUri() { var resolved = new object(); var metadata = new UriResolvedMetadata(new Uri("tst://tab/module/item"), null); this._uriResolvedObjectHolder.Contains(resolved).Returns(true); this._uriResolvedObjectHolder.GetMetadata(resolved).Returns(metadata); var shell = this.CreateShell(); var newUri = new Uri("tst://tab/module/item?param=1"); shell.UpdateResolvedUri(resolved, newUri); Assert.AreEqual(newUri, shell.GetResolvedUri(resolved)); }
public void ClosesResolvedUsingMetadataDisposable() { var resolved = new object(); var disposable = Substitute.For <IDisposable>(); var metadata = new UriResolvedMetadata(new Uri("tst://tab/module/item"), disposable); this._uriResolvedObjectHolder.Contains(resolved).Returns(true); this._uriResolvedObjectHolder.GetMetadata(resolved).Returns(metadata); disposable .When(d => d.Dispose()) .Do(_ => this._uriResolvedObjectHolder.Contains(resolved).Returns(false)); var shell = this.CreateShell(); shell.CloseResolved(resolved); disposable.Received(1).Dispose(); }