using NUnit.Framework; using System; using TINK.Model; namespace TestTINKLib.Fixtures.ObjectTests { [TestFixture] public class TestWhatsNew { [Test] public void TestIsShowRequired_CleanInstall() { Assert.IsFalse(new WhatsNew( new Version(2, 4), /* Current version */ null, // last version null /* Whats new was never shown */ ).IsShowRequired); } [Test] public void TestIsShowRequired_Update_VersionWhichSupporsWhatsNew() { Assert.IsTrue( new WhatsNew( new Version(2, 5), /* Current version */ new Version(2, 3), /* last version */ new Version(2, 1) /* Version when whats new was shown */ ).IsShowRequired, "If whats new was last shonw for version 2.1 and current version is 2.5 info must be shown"); } [Test] public void TestIsShowRequired_Update_VersionWithoutWhatsNew() { Assert.IsTrue( new WhatsNew( new Version(2, 5), /* Current version */ new Version(2, 3), /* last version */ null /* Whats new was never shown */ ).IsShowRequired, "If whats new was never shown but last version was 2.3 (not clean install) info must be shown"); } [Test] public void TestIsShowRequired_False() { Assert.IsFalse( new WhatsNew(new Version(2, 5), new Version(2, 5), new Version(2, 5)).IsShowRequired, "Whats new must never be presented twice."); } [Test] public void TestIsShowRequired_False_Errors() { Assert.IsFalse(new WhatsNew(null, new Version(2,6), new Version(2, 5)).IsShowRequired); Assert.IsFalse(new WhatsNew(new Version(2, 6), null, new Version(2, 5)).IsShowRequired); Assert.IsFalse(new WhatsNew(null, null, new Version(2, 5)).IsShowRequired); } [Test] public void TestWhatsNewText_MajorUpdate() { Assert.AreEqual( "

3.0.0.115
Benutzeroberfläche verbessert.\r\n\r\n" + "

3.0.120
Verbesserung: Keine Fehler mehr beim schnellen Tippen.\r\nOfflineanzeige Stationen/ Räderinfo.\r\n\r\n

", new WhatsNew(new Version(3, 0, 120), new Version(3, 0, 0, 114), new Version(3, 0, 0, 114)).WhatsNewText, "Current version is 30.0.120, last whats new was shown in version 3.0.0.114: Two changes to be notified about."); } [Test] public void TestWhatsNewText_MinorUpdate() { Assert.AreEqual( "

3.0.120
Verbesserung: Keine Fehler mehr beim schnellen Tippen.\r\nOfflineanzeige Stationen/ Räderinfo.\r\n\r\n

", new WhatsNew(new Version(3, 0, 120), new Version(3, 0, 0, 115), new Version(3, 0, 0, 115)).WhatsNewText); } } }