예제 #1
0
        public void ThrowsExceptionWhenRemovingUnknownResolved()
        {
            var table = new UriDisconnectTable();

            var resolved = "unknown456";

            ExceptionAssert.Throws <KeyNotFoundException>(
                ex => ex.Message.Equals(string.Format(Properties.Resources.UriResolvedNotRegisteredForDisconnect, resolved)),
                () => table.Remove(resolved));
        }
예제 #2
0
        public void ThrowsExceptionWhenGettingPlacementConnectorForUnknownResolved()
        {
            var table = new UriDisconnectTable();
            IUriPlacementConnector connector = null;

            var resolved = "unknown123";

            ExceptionAssert.Throws <KeyNotFoundException>(
                ex => ex.Message.Equals(string.Format(Properties.Resources.UriResolvedNotRegisteredForDisconnect, resolved)),
                () => connector = table[resolved]);
        }
예제 #3
0
        public void SetsPlacementConnectorForResolved()
        {
            var resolved = new object();

            var shell = Substitute.For <IShell>();

            shell.IsResolvedOpen(resolved).Returns(true);

            var table     = new UriDisconnectTable();
            var connector = Substitute.For <IUriPlacementConnector>();

            table[resolved] = connector;

            var connectorFromTable = table[resolved];

            Assert.AreSame(connector, connectorFromTable);
        }
예제 #4
0
        public void ThrowsExceptionWhenGettingPlacementConnectorAfterRemove()
        {
            var resolved = new object();

            var shell = Substitute.For <IShell>();

            shell.IsResolvedOpen(resolved).Returns(true);

            var table     = new UriDisconnectTable();
            var connector = Substitute.For <IUriPlacementConnector>();

            table[resolved] = connector;
            table.Remove(resolved);

            ExceptionAssert.Throws <KeyNotFoundException>(
                ex => ex.Message.Equals(string.Format(Properties.Resources.UriResolvedNotRegisteredForDisconnect, resolved)),
                () => connector = table[resolved]);
        }