diff options
author | Jose Miguel Torres <jostor@microsoft.com> | 2020-01-15 18:42:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-15 18:42:02 +0300 |
commit | 173d2294466251e76c910738060bd94692d75cfa (patch) | |
tree | 27d82247a81cd932ec468ecb6f9f3353ca36fa55 /main/src/addins/MonoDevelop.UnitTesting | |
parent | 967dbe01c855c59b5ad545966954210ececc12d2 (diff) | |
parent | 9d3876b19ac294d913958625fb964f2a0897a613 (diff) |
Merge pull request #9447 from mono/nrefactory-removal
Remove various references to NRefactory that are not used
Diffstat (limited to 'main/src/addins/MonoDevelop.UnitTesting')
4 files changed, 16 insertions, 35 deletions
diff --git a/main/src/addins/MonoDevelop.UnitTesting/AddinInfo.cs b/main/src/addins/MonoDevelop.UnitTesting/AddinInfo.cs index f873a69fa0..4bba15a67a 100644 --- a/main/src/addins/MonoDevelop.UnitTesting/AddinInfo.cs +++ b/main/src/addins/MonoDevelop.UnitTesting/AddinInfo.cs @@ -6,6 +6,7 @@ using Mono.Addins.Description; [assembly:Addin ("UnitTesting", Namespace = "MonoDevelop", Version = MonoDevelop.BuildInfo.Version, + CompatVersion = "8.5", Category = "Testing")] [assembly:AddinName ("Unit Testing core support")] diff --git a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.csproj b/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.csproj index 8d42275ca8..d768bb8c33 100644 --- a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.csproj +++ b/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.csproj @@ -48,11 +48,6 @@ <Name>Xwt</Name> <Private>False</Private> </ProjectReference> - <ProjectReference Include="..\..\..\external\nrefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> - <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> - <Name>ICSharpCode.NRefactory</Name> - <Private>False</Private> - </ProjectReference> <ProjectReference Include="..\MonoDevelop.DotNetCore\MonoDevelop.DotNetCore.csproj"> <Project>{6868153E-41EA-43A4-A81A-C1E7256373F7}</Project> <Name>MonoDevelop.DotNetCore</Name> diff --git a/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractResultsStore.cs b/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractResultsStore.cs index ba03343c15..43bba4ebe1 100644 --- a/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractResultsStore.cs +++ b/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractResultsStore.cs @@ -401,37 +401,21 @@ namespace MonoDevelop.UnitTesting } [Serializable] - public class TestRecordCollection: CollectionBase + public class TestRecordCollection: List<TestRecord> { - public TestRecord this [int n] { - get { return (TestRecord) ((IList)this) [n]; } - } - public TestRecord this [string name] { get { - for (int n=0; n<List.Count; n++) - if (((TestRecord)List [n]).Name == name) - return (TestRecord) List [n]; + foreach (var value in this) { + if (value.Name == name) + return value; + } return null; } } - - public void Add (TestRecord test) - { - ((IList)this).Add (test); - } } [Serializable] - public class UnitTestResultCollection: CollectionBase + public class UnitTestResultCollection: List<UnitTestResult> { - public UnitTestResult this [int n] { - get { return (UnitTestResult) ((IList)this) [n]; } - } - - public void Add (UnitTestResult test) - { - ((IList)this).Add (test); - } } } diff --git a/main/src/addins/MonoDevelop.UnitTesting/Services/BinaryResultsStore.cs b/main/src/addins/MonoDevelop.UnitTesting/Services/BinaryResultsStore.cs index 449ce82484..d57c51d0f7 100644 --- a/main/src/addins/MonoDevelop.UnitTesting/Services/BinaryResultsStore.cs +++ b/main/src/addins/MonoDevelop.UnitTesting/Services/BinaryResultsStore.cs @@ -26,7 +26,7 @@ using System; using System.Xml.Serialization; using System.IO; -using ICSharpCode.NRefactory.Utils; +using Newtonsoft.Json; namespace MonoDevelop.UnitTesting { @@ -54,7 +54,7 @@ namespace MonoDevelop.UnitTesting const string binaryExtension = ".test-result"; const string xmlExtension = ".xml"; - FastSerializer fastSerializer = new FastSerializer(); + JsonSerializer jsonSerializer = JsonSerializer.CreateDefault (); XmlSerializer xmlSerializer; XmlSerializer XmlSerializer { @@ -72,9 +72,10 @@ namespace MonoDevelop.UnitTesting // no need for xml serialization because next time it will be // deserialized from the binary format string binaryFilePath = GetBinaryFilePath (xmlFilePath); - using (var stream = File.OpenWrite(binaryFilePath)) { - fastSerializer.Serialize (stream, testRecord); - } + using var stream = File.OpenWrite (binaryFilePath); + using var writer = new StreamWriter (stream); + + jsonSerializer.Serialize (writer, testRecord); } public TestRecord Deserialize (string xmlFilePath) @@ -83,9 +84,9 @@ namespace MonoDevelop.UnitTesting // deserialize from the binary format if the file exists if (File.Exists(binaryFilePath)) { - using (var stream = File.OpenRead (binaryFilePath)) { - return (TestRecord) fastSerializer.Deserialize (stream); - } + using var stream = File.OpenRead (binaryFilePath); + using var reader = new JsonTextReader (new StreamReader (stream)); + return jsonSerializer.Deserialize<TestRecord> (reader); } // deserialize from xml if the file exists |