コード例 #1
0
        public static void CheckFileVersion(this INewVersionNotifierTestFixture fixture, string expectedVersion)
        {
            string filePath = Path.Combine(
                fixture.TestFrame.EnvironmentManager.TestEnvironmentDir,
                "Plugins",
                "NewVersionNotifier",
                ".lastversion.txt"
                );

            CommonActions.FileContains(
                filePath,
                Regex.Escape(expectedVersion)
                );
        }
コード例 #2
0
        public static void DoNewVersionTest(this INewVersionNotifierTestFixture fixture)
        {
            string versString = ChaskisConstants.ExpectedChaskisExeVersion;

            string expectedStr = @"I\s+have\s+been\s+upgraded\s+to\s+version\s+" + Regex.Escape(versString);

            Step.Run(
                "Wait for bot to relay message",
                () =>
            {
                fixture.TestFrame.IrcServer.WaitForMessageOnChannel(
                    expectedStr,
                    TestConstants.Channel1,
                    15 * 1000     // Wait 15 seconds, since we need to finish joining and what-not.
                    ).FailIfFalse("Did not get new version notification");

                fixture.TestFrame.IrcServer.WaitForMessageOnChannel(
                    expectedStr,
                    TestConstants.Channel2
                    ).FailIfFalse("Did not get new version notification");
            }
                );
            // Read the file.  Ensure the file is saved in there.

            Step.Run(
                "Ensure file got updated",
                () =>
            {
                // Wait for the notification, and then read the file and ensure the version got saved correctly.
                fixture.TestFrame.ProcessRunner.WaitForStringFromChaskis(
                    @"new_version_notifier's\s+\.lastversion\.txt\s+file\s+has\s+been\s+updated"
                    ).FailIfFalse("Did not get notification that the file got updated");

                fixture.CheckFileVersion(versString);
            }
                );
        }