2020-12-20 08:36:11 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
2015-06-23 18:10:50 +02:00
|
|
|
using NUnit.Framework;
|
2021-02-18 11:06:02 +01:00
|
|
|
using Umbraco.Extensions;
|
2015-06-23 18:10:50 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core;
|
|
|
|
|
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class VersionExtensionTests
|
2015-06-23 18:10:50 +02:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
[TestCase(1, 0, 0, 0, "0.2147483647.2147483647.2147483647")]
|
|
|
|
|
[TestCase(1, 1, 0, 0, "1.0.2147483647.2147483647")]
|
|
|
|
|
[TestCase(1, 1, 1, 0, "1.1.0.2147483647")]
|
|
|
|
|
[TestCase(1, 1, 1, 1, "1.1.1.0")]
|
|
|
|
|
[TestCase(0, 1, 0, 0, "0.0.2147483647.2147483647")]
|
|
|
|
|
[TestCase(0, 1, 1, 0, "0.1.0.2147483647")]
|
|
|
|
|
[TestCase(0, 1, 1, 1, "0.1.1.0")]
|
|
|
|
|
[TestCase(0, 0, 1, 0, "0.0.0.2147483647")]
|
|
|
|
|
[TestCase(0, 0, 1, 1, "0.0.1.0")]
|
|
|
|
|
[TestCase(0, 0, 0, 1, "0.0.0.0")]
|
|
|
|
|
[TestCase(7, 3, 0, 0, "7.2.2147483647.2147483647")]
|
|
|
|
|
public void Subtract_Revision(int major, int minor, int build, int rev, string outcome)
|
2015-06-23 18:10:50 +02:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
var version = new Version(major, minor, build, rev);
|
2015-06-23 18:10:50 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
var result = version.SubtractRevision();
|
2015-06-23 18:10:50 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
Assert.AreEqual(new Version(outcome), result);
|
2015-06-23 18:10:50 +02:00
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
}
|