From 3e8c7f83d2ce580314b6e0bec90941d1a5d8a244 Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 24 Mar 2024 00:27:01 +0100 Subject: [PATCH 1/5] Restructure project structure makes it easier for the future to add more --- GSMEncoding.sln | 11 +++++++---- Tests/{ => Mediaburst.Text.Tests}/GsmEncodingTests.cs | 0 .../Mediaburst.Text.Tests.csproj | 0 .../Properties/AssemblyInfo.cs | 0 Tests/{ => Mediaburst.Text.Tests}/packages.config | 0 GSMEncoding.cs => src/MediaBurst.Text/GSMEncoding.cs | 0 .../MediaBurst.Text/Mediaburst.Text.csproj | 0 .../MediaBurst.Text/Mediaburst.Text.nuspec | 0 .../MediaBurst.Text/Properties}/AssemblyInfo.cs | 0 9 files changed, 7 insertions(+), 4 deletions(-) rename Tests/{ => Mediaburst.Text.Tests}/GsmEncodingTests.cs (100%) rename Tests/{ => Mediaburst.Text.Tests}/Mediaburst.Text.Tests.csproj (100%) rename Tests/{ => Mediaburst.Text.Tests}/Properties/AssemblyInfo.cs (100%) rename Tests/{ => Mediaburst.Text.Tests}/packages.config (100%) rename GSMEncoding.cs => src/MediaBurst.Text/GSMEncoding.cs (100%) rename Mediaburst.Text.csproj => src/MediaBurst.Text/Mediaburst.Text.csproj (100%) rename Mediaburst.Text.nuspec => src/MediaBurst.Text/Mediaburst.Text.nuspec (100%) rename {Properties => src/MediaBurst.Text/Properties}/AssemblyInfo.cs (100%) diff --git a/GSMEncoding.sln b/GSMEncoding.sln index acec2b0..aa0b621 100644 --- a/GSMEncoding.sln +++ b/GSMEncoding.sln @@ -1,9 +1,12 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mediaburst.Text", "Mediaburst.Text.csproj", "{695DABE3-1699-452B-A633-9649E1CADE4B}" +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34714.143 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mediaburst.Text", "src\Mediaburst.Text\Mediaburst.Text.csproj", "{695DABE3-1699-452B-A633-9649E1CADE4B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mediaburst.Text.Tests", "Tests\Mediaburst.Text.Tests\Mediaburst.Text.Tests.csproj", "{3427C04B-0634-45BD-B516-7DD7A8E645FB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mediaburst.Text.Tests", "Tests\Mediaburst.Text.Tests.csproj", "{3427C04B-0634-45BD-B516-7DD7A8E645FB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Tests/GsmEncodingTests.cs b/Tests/Mediaburst.Text.Tests/GsmEncodingTests.cs similarity index 100% rename from Tests/GsmEncodingTests.cs rename to Tests/Mediaburst.Text.Tests/GsmEncodingTests.cs diff --git a/Tests/Mediaburst.Text.Tests.csproj b/Tests/Mediaburst.Text.Tests/Mediaburst.Text.Tests.csproj similarity index 100% rename from Tests/Mediaburst.Text.Tests.csproj rename to Tests/Mediaburst.Text.Tests/Mediaburst.Text.Tests.csproj diff --git a/Tests/Properties/AssemblyInfo.cs b/Tests/Mediaburst.Text.Tests/Properties/AssemblyInfo.cs similarity index 100% rename from Tests/Properties/AssemblyInfo.cs rename to Tests/Mediaburst.Text.Tests/Properties/AssemblyInfo.cs diff --git a/Tests/packages.config b/Tests/Mediaburst.Text.Tests/packages.config similarity index 100% rename from Tests/packages.config rename to Tests/Mediaburst.Text.Tests/packages.config diff --git a/GSMEncoding.cs b/src/MediaBurst.Text/GSMEncoding.cs similarity index 100% rename from GSMEncoding.cs rename to src/MediaBurst.Text/GSMEncoding.cs diff --git a/Mediaburst.Text.csproj b/src/MediaBurst.Text/Mediaburst.Text.csproj similarity index 100% rename from Mediaburst.Text.csproj rename to src/MediaBurst.Text/Mediaburst.Text.csproj diff --git a/Mediaburst.Text.nuspec b/src/MediaBurst.Text/Mediaburst.Text.nuspec similarity index 100% rename from Mediaburst.Text.nuspec rename to src/MediaBurst.Text/Mediaburst.Text.nuspec diff --git a/Properties/AssemblyInfo.cs b/src/MediaBurst.Text/Properties/AssemblyInfo.cs similarity index 100% rename from Properties/AssemblyInfo.cs rename to src/MediaBurst.Text/Properties/AssemblyInfo.cs From 05ea0d4b695c92363eda5347c6060e7eb88307dc Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 24 Mar 2024 00:34:39 +0100 Subject: [PATCH 2/5] Update old projects to .Net framework 4.8 Keeping the old projects to the what seems to be the last major version of .Net Framework --- Tests/Mediaburst.Text.Tests/Mediaburst.Text.Tests.csproj | 7 +++++-- src/MediaBurst.Text/Mediaburst.Text.csproj | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Tests/Mediaburst.Text.Tests/Mediaburst.Text.Tests.csproj b/Tests/Mediaburst.Text.Tests/Mediaburst.Text.Tests.csproj index b19f04c..c745d5a 100644 --- a/Tests/Mediaburst.Text.Tests/Mediaburst.Text.Tests.csproj +++ b/Tests/Mediaburst.Text.Tests/Mediaburst.Text.Tests.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,8 +10,9 @@ Properties Mediaburst.Text.Tests Mediaburst.Text.Tests - v4.0 + v4.8 512 + true @@ -22,6 +23,7 @@ prompt 4 true + false pdbonly @@ -30,6 +32,7 @@ TRACE prompt 4 + false diff --git a/src/MediaBurst.Text/Mediaburst.Text.csproj b/src/MediaBurst.Text/Mediaburst.Text.csproj index 0daaa55..5de34d9 100644 --- a/src/MediaBurst.Text/Mediaburst.Text.csproj +++ b/src/MediaBurst.Text/Mediaburst.Text.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,12 +10,13 @@ Properties Mediaburst.Text Mediaburst.Text - v4.0 + v4.8 512 SAK SAK SAK SAK + true @@ -25,6 +26,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -33,6 +35,7 @@ TRACE prompt 4 + false true From da48f3700555b3acffe4a80b5996cf880a011915 Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 24 Mar 2024 00:51:51 +0100 Subject: [PATCH 3/5] Update Nunit dependency Make project buildable again using newer nunit Moves ignore comment into the ignore attribute parameter Migrate Assert.Equals to Assert.That due to nunit upgrades Add testadapter to be able to run tests in visual studio --- .../Mediaburst.Text.Tests/GsmEncodingTests.cs | 88 +++++++++---------- .../Mediaburst.Text.Tests.csproj | 29 ++++-- .../Properties/AssemblyInfo.cs | 1 - Tests/Mediaburst.Text.Tests/packages.config | 5 +- 4 files changed, 71 insertions(+), 52 deletions(-) diff --git a/Tests/Mediaburst.Text.Tests/GsmEncodingTests.cs b/Tests/Mediaburst.Text.Tests/GsmEncodingTests.cs index a40e9e7..c6ba13d 100644 --- a/Tests/Mediaburst.Text.Tests/GsmEncodingTests.cs +++ b/Tests/Mediaburst.Text.Tests/GsmEncodingTests.cs @@ -1,5 +1,4 @@ -using NUnit.Framework; - +using NUnit.Framework; namespace Mediaburst.Text.Tests { @@ -31,7 +30,7 @@ public class GsmEncodingTests /// /// Regular string encoding - /// + /// [Test] public void GetBytes_NormalString_Success() { @@ -40,15 +39,15 @@ public void GetBytes_NormalString_Success() var result = m_GsmEncoding.GetBytes(input); - Assert.AreEqual(expectedResult, result); + Assert.That(result, Is.EqualTo(expectedResult)); } #region NULL tests /// /// NULL character in the middle of string should be replaced with space (0x20) - /// - [Test, Ignore] // Need to check expected behaviour on this + /// + [Test, Ignore("Need to check expected behaviour on this")] public void GetBytes_NullInsideString_Success() { const string input = "a\0b"; @@ -56,13 +55,13 @@ public void GetBytes_NullInsideString_Success() var result = m_GsmEncoding.GetBytes(input); - Assert.AreEqual(expectedResult, result); + Assert.That(result, Is.EqualTo(expectedResult)); } /// /// NULL character in the middle of string should not be replaced with space (32) if followed by FORM FEED - /// - [Test, Ignore] // Need to check expected behaviour on this + /// + [Test, Ignore("Need to check expected behaviour on this")] public void GetBytes_NullFollowedByFormFeedInsideString_Success() { string input = "a\0" + _FF + "b"; @@ -70,13 +69,13 @@ public void GetBytes_NullFollowedByFormFeedInsideString_Success() var result = m_GsmEncoding.GetBytes(input); - Assert.AreEqual(expectedResult, result); + Assert.That(result, Is.EqualTo(expectedResult)); } /// /// Sequence of NULL characters in the middle of string should be replaced with spaces (32) - /// - [Test, Ignore] // Need to check expected behaviour on this + /// + [Test, Ignore("Need to check expected behaviour on this")] public void GetBytes_SequenceOfNullsInsideString_Success() { const string input = "a\0\0\0b"; @@ -84,27 +83,27 @@ public void GetBytes_SequenceOfNullsInsideString_Success() var result = m_GsmEncoding.GetBytes(input); - Assert.AreEqual(expectedResult, result); + Assert.That(result, Is.EqualTo(expectedResult)); } /// /// Sequence of NULL characters followed by form feed in the middle of string should not be replaced with spaces (32) - /// - [Test, Ignore] // Need to check expected behaviour on this + /// + [Test, Ignore("Need to check expected behaviour on this")] public void GetBytes_SequenceOfNullsFollowedByFormFeedInsideString_Success() { var input = "a\0\0\0" + _FF + "b"; var expectedResult = new byte[] { 97, 0, 0, 0, 27, 10, 98 }; - + var result = m_GsmEncoding.GetBytes(input); - Assert.AreEqual(expectedResult, result); + Assert.That(result, Is.EqualTo(expectedResult)); } /// /// NULL character in the end of string should be encoded as NULL - /// - [Test, Ignore] // Need to check expected behaviour on this + /// + [Test, Ignore("Need to check expected behaviour on this")] public void GetBytes_NullInTheEndOfString_Success() { const string input = "ab\0"; @@ -112,7 +111,7 @@ public void GetBytes_NullInTheEndOfString_Success() var result = m_GsmEncoding.GetBytes(input); - Assert.AreEqual(expectedResult, result); + Assert.That(result, Is.EqualTo(expectedResult)); } #endregion NULL tests @@ -121,7 +120,7 @@ public void GetBytes_NullInTheEndOfString_Success() /// /// COMMERCIAL AT character in the middle of string and not followed by NULL - /// + /// [Test] public void GetBytes_AtInTheMiddleOfString_Success() { @@ -130,13 +129,13 @@ public void GetBytes_AtInTheMiddleOfString_Success() var result = m_GsmEncoding.GetBytes(input); - Assert.AreEqual(expectedResult, result); + Assert.That(result, Is.EqualTo(expectedResult)); } /// /// COMMERCIAL AT character in the end of string. Encoder should append CARRIAGE RETURN - /// - [Test, Ignore] // Think the behaviour is wrong here + /// + [Test, Ignore("Think the behaviour is wrong here")] public void GetBytes_AtInTheEndOfString_Success() { const string input = "ab@"; @@ -144,14 +143,14 @@ public void GetBytes_AtInTheEndOfString_Success() var result = m_GsmEncoding.GetBytes(input); - Assert.AreEqual(expectedResult, result); + Assert.That(result, Is.EqualTo(expectedResult)); } /// - /// COMMERCIAL AT character in the middle of string followed by NULL. + /// COMMERCIAL AT character in the middle of string followed by NULL. /// Encoder should not append CARRIAGE RETURN because this NULL will be converted to space - /// - [Test, Ignore] // Need to check expected behaviour on this + /// + [Test, Ignore("Need to check expected behaviour on this")] public void GetBytes_AtFollowedByNullInTheMiddleOfString_Success() { const string input = "a@\0b"; @@ -159,14 +158,14 @@ public void GetBytes_AtFollowedByNullInTheMiddleOfString_Success() var result = m_GsmEncoding.GetBytes(input); - Assert.AreEqual(expectedResult, result); + Assert.That(result, Is.EqualTo(expectedResult)); } /// - /// COMMERCIAL AT character in the end of string followed by NULL. + /// COMMERCIAL AT character in the end of string followed by NULL. /// Encoder should append CARRIAGE RETURN because this NULL will not be converted to space - /// - [Test, Ignore] // Need to check expected behaviour on this + /// + [Test, Ignore("Need to check expected behaviour on this")] public void GetBytes_AtFollowedByNullInTheEndOfString_Success() { const string input = "ab@\0"; @@ -174,18 +173,18 @@ public void GetBytes_AtFollowedByNullInTheEndOfString_Success() var result = m_GsmEncoding.GetBytes(input); - Assert.AreEqual(expectedResult, result); + Assert.That(result, Is.EqualTo(expectedResult)); } /// - /// COMMERCIAL AT character in the middle of string followed by NULL and FORM FEED. + /// COMMERCIAL AT character in the middle of string followed by NULL and FORM FEED. /// Encoder should append CARRIAGE RETURN and not replace NULL with space - /// - [Test, Ignore] // Need to check expected behaviour on this + /// + [Test, Ignore("Need to check expected behaviour on this")] public void GetBytes_AtFollowedByNullAndFormFeedInTheMiddleOfString_Success() { var input = "a@\0" + _FF + "b"; - var expectedResult = new byte[] { + var expectedResult = new byte[] { 97, // a 0, 13, // @ 0, // \0 @@ -195,7 +194,7 @@ public void GetBytes_AtFollowedByNullAndFormFeedInTheMiddleOfString_Success() var result = m_GsmEncoding.GetBytes(input); - Assert.AreEqual(expectedResult, result); + Assert.That(result, Is.EqualTo(expectedResult)); } #endregion COMMERCIAL AT tests @@ -206,31 +205,31 @@ public void GetBytes_AtFollowedByNullAndFormFeedInTheMiddleOfString_Success() /// /// Chars from default extended table - /// + /// [Test] public void GetBytesGetString_ExtendedTableChars_Success() { var encoded = m_GsmEncoding.GetBytes(_AllExtTableChars); var decoded = m_GsmEncoding.GetString(encoded); - Assert.AreEqual(_AllExtTableChars, decoded); + Assert.That(decoded, Is.EqualTo(_AllExtTableChars)); } /// /// Main table chars - /// + /// [Test] public void GetBytesGetString_MainTableChars_Success() { var encoded = m_GsmEncoding.GetBytes(_AllMainTableChars); var decoded = m_GsmEncoding.GetString(encoded); - Assert.AreEqual(_AllMainTableChars, decoded); + Assert.That(decoded, Is.EqualTo(_AllMainTableChars)); } /// /// Currency symbols - /// + /// [Test] public void GetBytesGetString_CurrencySymbols_Success() { @@ -239,10 +238,9 @@ public void GetBytesGetString_CurrencySymbols_Success() var encoded = m_GsmEncoding.GetBytes(input); var decoded = m_GsmEncoding.GetString(encoded); - Assert.AreEqual(input, decoded); + Assert.That(decoded, Is.EqualTo(input)); } - #endregion Encode and decode } } diff --git a/Tests/Mediaburst.Text.Tests/Mediaburst.Text.Tests.csproj b/Tests/Mediaburst.Text.Tests/Mediaburst.Text.Tests.csproj index c745d5a..34d9db4 100644 --- a/Tests/Mediaburst.Text.Tests/Mediaburst.Text.Tests.csproj +++ b/Tests/Mediaburst.Text.Tests/Mediaburst.Text.Tests.csproj @@ -1,5 +1,7 @@  + + Debug AnyCPU @@ -13,6 +15,8 @@ v4.8 512 + + true @@ -35,12 +39,20 @@ false - - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - True + + ..\..\packages\NUnit.4.1.0\lib\net462\nunit.framework.dll + + + ..\..\packages\NUnit.4.1.0\lib\net462\nunit.framework.legacy.dll + + ..\..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + @@ -52,7 +64,7 @@ - + {695DABE3-1699-452B-A633-9649E1CADE4B} Mediaburst.Text @@ -61,7 +73,14 @@ -