コード例 #1
0
ファイル: Basics.cs プロジェクト: digitalsoft/hmailserver
        public void TestAwstatsLog()
        {
            Settings settings = SingletonProvider <TestSetup> .Instance.GetApp().Settings;

            Logging logging = settings.Logging;

            logging.AWStatsEnabled = true;
            logging.Enabled        = true;

            if (File.Exists(logging.CurrentAwstatsLog))
            {
                File.Delete(logging.CurrentAwstatsLog);
            }

            Account oAccount1 = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            IPAddress localAddress = TestSetup.GetLocalIpAddress();
            var       oSMTP        = new SMTPClientSimulator(false, 25, localAddress);

            // Delivery from external to local.
            CustomAssert.IsTrue(oSMTP.Send("*****@*****.**", "*****@*****.**", "Mail 1", "Mail 1"));
            POP3ClientSimulator.AssertMessageCount("*****@*****.**", "test", 1);
            string contents = TestSetup.ReadExistingTextFile(logging.CurrentAwstatsLog);

            TestSetup.AssertDeleteFile(logging.CurrentAwstatsLog);
            string expectedString = string.Format("\[email protected]\[email protected]\t{0}\t127.0.0.1\tSMTP\t?\t250\t",
                                                  localAddress);

            CustomAssert.IsTrue(contents.Contains(expectedString), contents);

            // Failed delivery from local to local.
            CustomAssert.IsFalse(oSMTP.Send("*****@*****.**", "*****@*****.**", "Mail 1", "Mail 1"));
            contents = TestSetup.ReadExistingTextFile(logging.CurrentAwstatsLog);
            TestSetup.AssertDeleteFile(logging.CurrentAwstatsLog);
            expectedString = string.Format("\[email protected]\[email protected]\t{0}\t127.0.0.1\tSMTP\t?\t530\t",
                                           localAddress);
            CustomAssert.IsTrue(contents.Contains(expectedString), contents);
        }
コード例 #2
0
        public void ReferenceSourceWithCodeFool()
        {
            CustomAssert.IsTrue(
                EmailAddressValidator.ReferenceSource,
                Examples.Valid,

                // False negatives:
                new[]
            {
                @"much.“more\ unusual”@example.com",
                @"very.unusual.“@”[email protected]",
                @"very.“(),:;<>[]”.VERY.“very@\ ""very”[email protected]",
            }

                );

            CustomAssert.IsFalse(
                EmailAddressValidator.ReferenceSource,
                Examples.Invalid,

                // False positives:
                new[]
            {
                @"*****@*****.**",
                @"Joe Smith <*****@*****.**>",
                @"*****@*****.**",
                @"*****@*****.**",
                @"*****@*****.**",
                @"[email protected]",
                @"email@example",
                @"*****@*****.**",
                @"[email protected] (Joe Smith)",
                @"*****@*****.**",
                @"あいうえお@example.com",
            }

                );
        }
コード例 #3
0
        public static void AssertSpamAssassinIsRunning()
        {
            Process[] processlist = Process.GetProcesses();

            foreach (Process theprocess in processlist)
            {
                if (theprocess.ProcessName == "spamd")
                {
                    return;
                }
            }

            // Check if we can launch it...
            try
            {
                var serviceController = new ServiceController("SpamAssassinJAM");
                serviceController.Start();
            }
            catch (Exception)
            {
                CustomAssert.Inconclusive("Unable to start SpamAssassin process. Is SpamAssassin installed?");
            }
        }
コード例 #4
0
            public void Set()
            {
                var xml = Xml("<Foo/>");
                var foo = Create <IFoo>(xml);

                foo.Value = "value";

                CustomAssert.AreXmlEquivalent(string.Concat
                                              (
                                                  "<Foo>",
                                                  "<A>",
                                                  "<C H='value'>",
                                                  "<D E=''>",
                                                  "<F>f</F>",
                                                  "</D>",
                                                  "<G/>",
                                                  "</C>",
                                                  "<B>b</B>",
                                                  "</A>",
                                                  "</Foo>"
                                              ), xml);
                Assert.AreEqual("value", foo.Value);
            }
コード例 #5
0
        public void TestImportDuplicateMessage()
        {
            string @messageText =
                "From: [email protected]\r\n" +
                "\r\n" +
                "Test\r\n";

            Account account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            string domainPath  = Path.Combine(_application.Settings.Directories.DataDirectory, "test.com");
            string accountPath = Path.Combine(domainPath, "test");

            Directory.CreateDirectory(accountPath);

            string fileName = Path.Combine(accountPath, "something.eml");

            File.WriteAllText(fileName, messageText);

            CustomAssert.IsTrue(_application.Utilities.ImportMessageFromFile(fileName, account.ID));
            CustomAssert.IsFalse(_application.Utilities.ImportMessageFromFile(fileName, account.ID));

            POP3ClientSimulator.AssertMessageCount("*****@*****.**", "test", 1);
        }
コード例 #6
0
ファイル: SysXmlCursorTestCase.cs プロジェクト: belav/Core
        public void AsVirtual_WhenParentIsVirtualNode()
        {
            var        xml = Xml("<X/>");
            IXmlCursor cursor;

            cursor = xml.SelectChildren(
                KnownTypes,
                NamespaceSource.Instance,
                CursorFlags.Elements | CursorFlags.Mutable
                );
            cursor.MoveNext();
            cursor = cursor.SelectChildren(
                KnownTypes,
                NamespaceSource.Instance,
                CursorFlags.Elements | CursorFlags.Mutable
                );
            cursor.MoveNext();
            var node = (IXmlNode)cursor;

            node.Value = "1";

            CustomAssert.AreXmlEquivalent("<X> <Item><Item>1</Item></Item> </X>", xml.GetNode());
        }
コード例 #7
0
ファイル: Basics.cs プロジェクト: shaqman/hmailserver
        public void TestTOPSpecificPartial()
        {
            Account account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            for (int i = 1; i <= 10; i++)
            {
                SMTPClientSimulator.StaticSend(account.Address, account.Address, "Test",
                                               "Line1\r\nLine2\r\nLine3\r\nLine4\r\nLine\r\n");
            }

            POP3ClientSimulator.AssertMessageCount(account.Address, "test", 10);

            var sim = new POP3ClientSimulator();

            sim.ConnectAndLogon(account.Address, "test");
            string result = sim.TOP(4, 2);

            CustomAssert.IsTrue(result.Contains("Received"));
            CustomAssert.IsTrue(result.Contains("Line1"));
            CustomAssert.IsTrue(result.Contains("Line2"));
            CustomAssert.IsFalse(result.Contains("Line3"));
            CustomAssert.IsFalse(result.Contains("Line4"));
        }
コード例 #8
0
ファイル: CacheSettingsTests.cs プロジェクト: ShaneGH/xyz
        public void GetCacheTime_WithAllHeadersToSMaxAge_RespectsCorrectHeaders()
        {
            // arrange
            var cacheHeaders = BuildHeaders(
                immutable: true,
                sharedCache: true,
                eTag: new EntityTagHeaderValue("\"an etag\"", false),
                maxAge: TimeSpan.FromDays(1),
                sMaxAge: TimeSpan.FromDays(2),
                exipiresUtc: DateTime.UtcNow.AddDays(3));

            // act
            var result = ((ExpirySettings.Soft)build(cacheHeaders).Value.ExpirySettings).Item;

            // assert
            var both = ((Validator.Both)result.Validator).Item;

            CustomAssert.Roughly(DateTime.UtcNow.AddDays(3), both.Item2);

            var etag = ((EntityTag.Strong)both.Item1).Item;

            Assert.AreEqual("\"an etag\"", etag);
        }
コード例 #9
0
ファイル: Unicode.cs プロジェクト: shaqman/hmailserver
        public void TestMostlyLatinCharacters()
        {
            Account account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            var message = new hMailServer.Message();

            message.AddRecipient("Test Recipient: Тест", account.Address);
            message.Subject = "Test Subject: Тест";
            message.Charset = "utf-8";
            message.Body    = "Test body.";
            message.Save();

            string messageText = POP3ClientSimulator.AssertGetFirstMessageText(account.Address, "test");

            // Important:
            //   RFC 2047: http://www.faqs.org/rfcs/rfc2047.html
            //   The notation of RFC 822 is used, with the exception that white space
            //   characters MUST NOT appear between components of an 'encoded-word'.
            //
            //   Also, there should be a space separating the encoded word with the following
            //   non-encoded word.
            CustomAssert.IsTrue(messageText.Contains("To: \"=?utf-8?B?VGVzdCBSZWNpcGllbnQ6INCi0LXRgdGC?=\" <*****@*****.**>"));
        }
コード例 #10
0
        public void TestDomainMaxSizeLimit()
        {
            _domain.MaxSize = 30;
            _domain.Save();

            SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "secret1", 10);

            SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "secret1", 10);

            SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "secret1", 10);


            try
            {
                SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "secret1", 10);
            }
            catch (Exception)
            {
                return;
            }

            CustomAssert.Fail("Max domain size limit exceeded.");
        }
コード例 #11
0
        public void TestDomainMaxMessageSizeLimit()
        {
            _domain.MaxMessageSize = 0;
            _domain.Save();

            SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "secret1", 0);

            var message = new StringBuilder();

            for (int i = 0; i < 10000; i++)
            {
                message.Append("ABCDEFGH");
            }

            CustomAssert.IsTrue(SMTPClientSimulator.StaticSend("*****@*****.**", "*****@*****.**", "TestSubject",
                                                               message.ToString()));
            POP3ClientSimulator.AssertMessageCount("*****@*****.**", "secret1", 1);
            _domain.MaxMessageSize = 50;
            _domain.Save();

            CustomAssert.IsFalse(SMTPClientSimulator.StaticSend("*****@*****.**", "*****@*****.**", "TestSubject",
                                                                message.ToString()));
        }
コード例 #12
0
        public void TestDomainLimitNumberOfDistributionLists()
        {
            _domain.MaxNumberOfDistributionListsEnabled = true;
            _domain.MaxNumberOfDistributionLists        = 2;
            _domain.Save();

            var recipients = new List <string>();

            SingletonProvider <TestSetup> .Instance.AddDistributionList(_domain, "*****@*****.**", recipients);

            SingletonProvider <TestSetup> .Instance.AddDistributionList(_domain, "*****@*****.**", recipients);

            try
            {
                SingletonProvider <TestSetup> .Instance.AddDistributionList(_domain, "*****@*****.**", recipients);
            }
            catch (Exception)
            {
                return;
            }

            CustomAssert.Fail("Number of aliases exceeded max no of accounts");
        }
コード例 #13
0
        public void TestDomainLimitNumberOfAccounts()
        {
            _domain.MaxNumberOfAccountsEnabled = true;
            _domain.MaxNumberOfAccounts        = 3;
            _domain.Save();

            SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "secret1");

            SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "secret1");

            SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "secret1");

            try
            {
                SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "secret1");
            }
            catch (Exception)
            {
                return;
            }

            CustomAssert.Fail("Number of accounts exceeded max no of accounts");
        }
コード例 #14
0
        public void CountCompareSkip_NegativeOverflow()
        {
            // arrange

            // set A to -2 with negative overflow
            Memory[0x000] = ((~2) & 0xBFFF).ToOnesCompliment();

            // insert instructions
            Memory.LoadFixedRom(new ushort[] {
                Instruction(0x01, 0x000) // CCS A
            });

            // act
            CPU.Execute();

            // assert

            // ensure result has positove overflow and is decremented
            CustomAssert.AreEqual((0x4000 | 0x0001), Memory[0x0]);

            // check that program counter advanced 3
            CustomAssert.AreEqual(0x803, Memory[0x05]);
        }
コード例 #15
0
        public void CountCompareSkip_PositiveOverflowAnd0()
        {
            // arrange

            // set A to 0 with positive overflow
            Memory[0x000] = new OnesCompliment(0x4000 | 0);

            // insert instructions
            Memory.LoadFixedRom(new ushort[] {
                Instruction(0x01, 0x000) // CCS A
            });

            // act
            CPU.Execute();

            // assert

            // check that A contains value without overflow
            CustomAssert.AreEqual(0x3FFF, Memory[0x0]);

            // check that program counter advanced 1
            CustomAssert.AreEqual(0x801, Memory[0x05]);
        }
コード例 #16
0
        public void TestMessageScoreNotMerged()
        {
            // Send a messages to this account.
            var smtpClientSimulator = new SMTPClientSimulator();

            smtpClientSimulator.Send(account.Address, account.Address, "SA test",
                                     "This is a test message with spam.\r\n XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X.");

            string sMessageContents = POP3ClientSimulator.AssertGetFirstMessageText(account.Address, "test");

            int scoreStart = sMessageContents.IndexOf("X-hMailServer-Reason-Score");

            CustomAssert.AreNotEqual(0, scoreStart);

            scoreStart = sMessageContents.IndexOf(":", scoreStart) + 2;
            int    scoreEnd    = sMessageContents.IndexOf("\r\n", scoreStart);
            int    scoreLength = scoreEnd - scoreStart;
            string score       = sMessageContents.Substring(scoreStart, scoreLength);

            double scoreValue = Convert.ToDouble(score);

            CustomAssert.Less(scoreValue, 10);
        }
コード例 #17
0
ファイル: Tests.cs プロジェクト: jstedfast/net-EmailAddress
        public void HaackedWithWikipedia()
        {
            CustomAssert.IsTrue(
                EmailAddressValidator.Haacked,
                Examples.Valid,

                // False negatives:
                new[]
            {
                @"""()<>[]:,;@\\""!#$%&'*+-/=?^_`{}| ~.a""@example.org",
                @"""very.(),:;<>[]\"".VERY.\""very@\ \""very\"".unusual""@strange.example.com",
                @"admin@mailserver1",
                @"üñîçøðé@example.com",
                @"üñîçøðé@üñîçøðé.com",
            }

                );

            CustomAssert.IsFalse(
                EmailAddressValidator.Haacked,
                Examples.Invalid
                );
        }
コード例 #18
0
        public int GetMessageCount(string sFolder)
        {
            string sData = SendSingleCommand("A33 SELECT " + sFolder);

            if (!sData.Contains("A33 OK"))
            {
                CustomAssert.Fail("The folder " + sFolder + " was not selectable. Result: " + sData);
                return(0);
            }

            int iStartPos = 2;
            int iEndPos   = sData.IndexOf(" ", iStartPos);
            int iLength   = iEndPos - iStartPos;

            if (iLength == 0)
            {
                CustomAssert.Fail("Unparseable SELECT response");
            }

            string sValue = sData.Substring(iStartPos, iLength);

            return(Convert.ToInt32(sValue));
        }
コード例 #19
0
            public void ListItemReference_Set()
            {
                var xml = Xml(
                    "<Foo $x>",
                    "<One> <Value>One</Value> </One>",
                    "<List>",
                    "<Foo> <Value>Two</Value> </Foo>",
                    "</List>",
                    "</Foo>"
                    );
                var foo = Create <IFoo>(xml);

                foo.List[0] = foo.One;

                CustomAssert.AreXmlEquivalent(Xml(
                                                  "<Foo $x>",
                                                  "<One x:id='1'> <Value>One</Value> </One>",
                                                  "<List>",
                                                  "<Foo x:ref='1'/>",
                                                  "</List>",
                                                  "</Foo>"
                                                  ), xml);
            }
コード例 #20
0
        public void TestHierarchyDelimiterListResponse()
        {
            Application application = SingletonProvider <TestSetup> .Instance.GetApp();

            Settings settings = _settings;

            settings.IMAPHierarchyDelimiter = "\\";

            Account account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            string folderName = "Test\\Test";

            var    oSimulator      = new IMAPClientSimulator();
            string sWelcomeMessage = oSimulator.Connect();

            oSimulator.Logon(account.Address, "test");
            CustomAssert.IsTrue(oSimulator.CreateFolder(folderName));
            string listResponse = oSimulator.List();

            CustomAssert.IsTrue(listResponse.Contains("\"Test\\Test\""));
            CustomAssert.IsTrue(listResponse.Contains("\"Test\""));
            oSimulator.Disconnect();
        }
コード例 #21
0
        public void whole_table_is_aligned_to_Right_without_explicit_columns()
        {
            DataGrid dataGrid = new DataGrid("This is a cell alignment test");

            dataGrid.DisplayColumnHeaders    = false;
            dataGrid.CellHorizontalAlignment = HorizontalAlignment.Right;

            dataGrid.Rows.Add("0,0", "0,1", "0,2");
            dataGrid.Rows.Add("1,0", "1,1", "1,2");
            dataGrid.Rows.Add("2,0", "2,1", "2,2");

            string expected =
                @"+-------------------------------+
| This is a cell alignment test |
+----------+----------+---------+
|      0,0 |      0,1 |     0,2 |
|      1,0 |      1,1 |     1,2 |
|      2,0 |      2,1 |     2,2 |
+----------+----------+---------+
";

            CustomAssert.TableRender(dataGrid, expected);
        }
コード例 #22
0
        public void TestSaveMessageInPublicIMAPFolder()
        {
            Settings settings = SingletonProvider <TestSetup> .Instance.GetApp().Settings;

            IMAPFolders publicFolders = settings.PublicFolders;

            IMAPFolder testFolder = publicFolders.Add("TestFolder");

            testFolder.Save();

            // Send a message to the account.
            hMailServer.Message oMessage = testFolder.Messages.Add();

            CustomAssert.AreEqual(0, oMessage.State);

            oMessage.Body    = "Välkommen till verkligheten";
            oMessage.Subject = "Hej";
            oMessage.Save();

            CustomAssert.AreEqual(2, oMessage.State);
            CustomAssert.IsTrue(oMessage.Filename.Contains(settings.PublicFolderDiskName));
            CustomAssert.IsFalse(oMessage.Filename.Contains(_domain.Name));
        }
コード例 #23
0
        public void Create()
        {
            var xml    = Xml("<X/>");
            var cursor = Cursor(xml, "A[B='b']/C[D[E][F='f'] and G]/@H", CursorFlags.Multiple);

            Assert.False(cursor.MoveNext());

            cursor.Create(TypeA.ClrType);
            cursor.Value = "h";

            CustomAssert.AreXmlEquivalent(string.Concat
                                          (
                                              "<X>",
                                              "<A>",
                                              "<C H='h'>",
                                              "<D> <E/> <F>f</F> </D>",
                                              "<G/>",
                                              "</C>",
                                              "<B>b</B>",
                                              "</A>",
                                              "</X>"
                                          ), xml);
        }
コード例 #24
0
ファイル: Append.cs プロジェクト: shaqman/hmailserver
        public void TestGlobalMaxMessageSizeLimitEnabled()
        {
            Account account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test", 0);

            var message = new StringBuilder();

            // ~2 kb string
            for (int i = 0; i < 25; i++)
            {
                message.AppendLine(
                    "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
            }

            _settings.MaxMessageSize = 1;

            var    imapSim = new IMAPClientSimulator("*****@*****.**", "test", "INBOX");
            string result  = imapSim.SendSingleCommandWithLiteral("A01 APPEND INBOX {" + message.Length + "}",
                                                                  message.ToString());

            imapSim.Logout();

            CustomAssert.IsTrue(result.StartsWith("A01 NO Message size exceeds fixed maximum message size."));
        }
コード例 #25
0
            public void Delete_Partial()
            {
                var xml = Xml
                          (
                    "<Foo>",
                    "<A>",
                    "<B Id='1'> <C>value1</C> </B>",
                    "<B Id='2'> <C>value2</C> </B>",
                    "</A>",
                    "</Foo>"
                          );

                Create <IFoo>(xml).A = null;

                CustomAssert.AreXmlEquivalent(string.Concat
                                              (
                                                  "<Foo>",
                                                  "<A>",
                                                  "<B Id='1'> <C>value1</C> </B>",
                                                  "</A>",
                                                  "</Foo>"
                                              ), xml);
            }
コード例 #26
0
        public void ReadShimWithoutExports()
        {
            var config = ReadJson(new TestFileReader());
            var shim   = new ShimEntry
            {
                For          = "jquery-validate-unobtrusive",
                Dependencies =
                    new List <RequireDependency>
                {
                    new RequireDependency
                    {
                        Dependency = "jquery"
                    },
                    new RequireDependency
                    {
                        Dependency = "jquery-validate"
                    }
                },
            };
            var expected = ConfigurationCreators.CreateCollectionWithShims(shim);

            CustomAssert.JsonEquals(expected, config);
        }
コード例 #27
0
        public static IMAPFolder AssertFolderExists(IMAPFolders folders, string folderName)
        {
            int timeout = 100;

            while (timeout > 0)
            {
                try
                {
                    return(folders.get_ItemByName(folderName));
                }
                catch (Exception)
                {
                }

                timeout--;
                Thread.Sleep(100);
            }

            string error = "Folder could not be found " + folderName;

            CustomAssert.Fail(error);
            return(null);
        }
コード例 #28
0
        public void RetrieveSeason()
        {
            var chartKey = CreateTestChart();

            var season         = Client.Seasons.Create(chartKey);
            var partialSeason1 = Client.Seasons.CreatePartialSeason(season.Key);
            var partialSeason2 = Client.Seasons.CreatePartialSeason(season.Key);

            var retrievedSeason = Client.Events.Retrieve(season.Key);

            Assert.NotNull(retrievedSeason.Key);
            Assert.NotEqual(0, retrievedSeason.Id);
            Assert.True(retrievedSeason.IsTopLevelSeason);
            Assert.Null(retrievedSeason.TopLevelSeasonKey);
            Assert.Equal(new[] { partialSeason1.Key, partialSeason2.Key }, retrievedSeason.PartialSeasonKeys);
            Assert.Empty(retrievedSeason.Events);
            Assert.Equal(chartKey, season.ChartKey);
            Assert.Equal("INHERIT", season.TableBookingConfig.Mode);
            Assert.True(season.SupportsBestAvailable);
            Assert.Null(season.ForSaleConfig);
            CustomAssert.CloseTo(DateTimeOffset.Now, season.CreatedOn.Value);
            Assert.Null(season.UpdatedOn);
        }
コード例 #29
0
        public void TestSMTPAuthExternalToExternal()
        {
            SecurityRange range =
                SingletonProvider <TestSetup> .Instance.GetApp().Settings.SecurityRanges.get_ItemByName("My computer");

            range.RequireSMTPAuthExternalToExternal = true;
            range.Save();

            var    oSMTP = new SMTPClientSimulator();
            string result;

            CustomAssert.IsFalse(oSMTP.Send("*****@*****.**", "*****@*****.**", "Mail 1",
                                            "Mail 1", out result));
            CustomAssert.IsTrue(result.Contains("SMTP authentication is required."));

            range.RequireSMTPAuthExternalToExternal = false;
            range.AllowDeliveryFromRemoteToRemote   = false;
            range.Save();

            CustomAssert.IsFalse(oSMTP.Send("*****@*****.**", "*****@*****.**", "Mail 1",
                                            "Mail 1", out result));
            CustomAssert.IsTrue(result.Contains("550 Delivery is not allowed to this address."));
        }
コード例 #30
0
        public async Task Prune_Removes_Closed_Entries_Only()
        {
            // arrange
            const string staleKey = "foo";

            var(staleHandle, staleWriter) = CreateAndRegisterWebSocketWriterMock(staleKey);
            staleWriter.SetupGet(w => w.IsClosed).Returns(true);
            const string activeKey = "bar";

            var(activeHandle, activeWriter) = CreateAndRegisterWebSocketWriterMock(activeKey);
            activeWriter.SetupGet(w => w.IsClosed).Returns(false);

            // act
            var result = this.sut.Prune();

            // assert
            var prunedKey = Assert.Single(result);

            Assert.Equal(staleKey, prunedKey);
            await CustomAssert.WriterIsNotRegistered(staleHandle);

            await CustomAssert.WriterIsRegistered(activeHandle, activeWriter);
        }