Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/api-doc-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Melnikov <mikhail_melnikov@epam.com>2018-04-27 14:54:16 +0300
committerJoel Martinez <joelmartinez@gmail.com>2018-04-27 22:46:20 +0300
commit89ef92404a729c67671e0daaa274320b9053bbd5 (patch)
tree42900884837df1f940cf8f7aec7c829eac435b2c /mdoc/mdoc.Test/BasicFormatterTests.cs
parent9d7610859c73d63bc4008e0de6595b9a72148a5b (diff)
Special treatment of ref-like structs to not produce Obsolete attribute
Added a unit test for MDocUpdater.GetCustomAttributes Added logic to skip the attribute `Obsolete` Changed test classes hierarchy Closes #225
Diffstat (limited to 'mdoc/mdoc.Test/BasicFormatterTests.cs')
-rw-r--r--mdoc/mdoc.Test/BasicFormatterTests.cs39
1 files changed, 1 insertions, 38 deletions
diff --git a/mdoc/mdoc.Test/BasicFormatterTests.cs b/mdoc/mdoc.Test/BasicFormatterTests.cs
index d6a2b442..d8685222 100644
--- a/mdoc/mdoc.Test/BasicFormatterTests.cs
+++ b/mdoc/mdoc.Test/BasicFormatterTests.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
using Mono.Documentation.Updater;
@@ -7,11 +6,8 @@ using NUnit.Framework;
namespace mdoc.Test
{
- public abstract class BasicFormatterTests<T> where T : MemberFormatter
+ public abstract class BasicFormatterTests<T> : BasicTests where T : MemberFormatter
{
- protected Dictionary<string, ModuleDefinition> moduleCash = new Dictionary<string, ModuleDefinition>();
- protected Dictionary<string, TypeDefinition> typesCash = new Dictionary<string, TypeDefinition>();
-
protected abstract T formatter { get; }
protected MethodDefinition GetMethod(Type type, Func<MethodDefinition, bool> query)
@@ -37,38 +33,6 @@ namespace mdoc.Test
return member;
}
- protected TypeDefinition GetType(string filepath, string classname)
- {
- if (typesCash.ContainsKey(classname))
- return typesCash[classname];
-
-
- if (!moduleCash.ContainsKey(filepath))
- {
- var readModule = ModuleDefinition.ReadModule(filepath);
- moduleCash.Add(filepath, readModule);
- }
-
- var module = moduleCash[filepath];
- var types = module.GetTypes();
- var testclass = types
- .SingleOrDefault(t => t.FullName == classname);
- if (testclass == null)
- {
- throw new Exception($"Test was unable to find type {classname}");
- }
-
- var typeDef = testclass.Resolve();
- typesCash.Add(classname, typeDef);
- return typeDef;
- }
-
- protected virtual TypeDefinition GetType(Type type)
- {
- var moduleName = type.Module.FullyQualifiedName;
- return GetType(moduleName, type.FullName);
- }
-
protected MemberReference GetProperty(TypeDefinition type, string memberName)
{
var property = type.Properties.FirstOrDefault(i => i.Name == memberName);
@@ -204,5 +168,4 @@ namespace mdoc.Test
return s?.Replace("\r\n", MemberFormatter.GetLineEnding());
}
}
-
}