예제 #1
0
        public async Task UpdateManager_CheckPerformUpdateAsync_Restart_Test()
        {
            using var dummy = new DummyEnvironment(TempDirPath);

            // Arrange
            var baseVersion       = Version.Parse("1.0.0.0");
            var availableVersions = new[]
            {
                Version.Parse("1.0.0.0"),
                Version.Parse("2.0.0.0"),
                Version.Parse("3.0.0.0")
            };

            dummy.Setup(baseVersion, availableVersions);

            // Act
            const string args = "update-and-restart and some extra arguments";
            await dummy.RunDummyAsync(args);

            // Wait a bit for update and restart
            await Task.Delay(50);

            // Assert
            Assert.That(dummy.GetLastRunArguments(availableVersions.Max()), Is.EqualTo(args), "Command line arguments from last run");
        }
예제 #2
0
        public async Task UpdateManager_CheckPerformUpdateAsync_Test()
        {
            using (var dummyEnvironment = new DummyEnvironment(TempDirPath))
            {
                // Arrange
                var baseVersion       = Version.Parse("1.0.0.0");
                var availableVersions = new[]
                {
                    Version.Parse("1.0.0.0"),
                    Version.Parse("2.0.0.0"),
                    Version.Parse("3.0.0.0")
                };

                dummyEnvironment.Setup(baseVersion, availableVersions);

                // Assert current version
                var oldVersion = await dummyEnvironment.GetCurrentVersionAsync();

                Assert.That(oldVersion, Is.EqualTo(baseVersion), "Version before update");

                // Update dummy via Onova
                await dummyEnvironment.CheckPerformUpdateAsync();

                // Assert current version again
                var newVersion = await dummyEnvironment.GetCurrentVersionAsync();

                Assert.That(newVersion, Is.EqualTo(availableVersions.Max()), "Version after update");
            }
        }
예제 #3
0
        public async Task UpdateManager_CheckPerformUpdateAsync_Test()
        {
            using var dummy = new DummyEnvironment(TempDirPath);

            // Arrange
            var baseVersion       = Version.Parse("1.0.0.0");
            var availableVersions = new[]
            {
                Version.Parse("1.0.0.0"),
                Version.Parse("2.0.0.0"),
                Version.Parse("3.0.0.0")
            };

            dummy.Setup(baseVersion, availableVersions);

            // Assert current version
            var oldVersion = await dummy.RunDummyAsync("version");

            Assert.That(Version.Parse(oldVersion), Is.EqualTo(baseVersion), "Version before update");

            // Act
            await dummy.RunDummyAsync("update");

            // Assert current version again
            var newVersion = await dummy.RunDummyAsync("version");

            Assert.That(Version.Parse(newVersion), Is.EqualTo(availableVersions.Max()), "Version after update");
        }
예제 #4
0
        public async Task UpdateManager_CheckPerformUpdateAsync_Test()
        {
            // Arrange
            DummyEnvironment.Setup(
                Version.Parse("1.0.0.0"),
                Version.Parse("1.0.0.0"), Version.Parse("2.0.0.0"), Version.Parse("3.0.0.0"));

            // Assert current version
            var oldVersion = await DummyEnvironment.GetCurrentVersionAsync();

            Assert.That(oldVersion, Is.EqualTo(Version.Parse("1.0.0.0")));

            // Update dummy via Onova
            await DummyEnvironment.CheckPerformUpdateAsync();

            // Assert current version again
            var newVersion = await DummyEnvironment.GetCurrentVersionAsync();

            Assert.That(newVersion, Is.EqualTo(Version.Parse("3.0.0.0")));
        }