AssemblyNameFilter.cs 974 B

12345678910111213141516171819202122232425
  1. using System;
  2. using NUnit.Framework.Interfaces;
  3. using NUnit.Framework.Internal.Filters;
  4. namespace UnityEngine.TestRunner.NUnitExtensions.Filters
  5. {
  6. internal class AssemblyNameFilter : ValueMatchFilter
  7. {
  8. public AssemblyNameFilter(string assemblyName) : base(assemblyName) {}
  9. public override bool Match(ITest test)
  10. {
  11. string assemblyName = string.Empty;
  12. //Assembly fullname is in the format "Assembly-name, meta data ...", so extract the name by looking for the comma
  13. if (test.TypeInfo != null && test.TypeInfo.Assembly != null && test.TypeInfo.FullName != null)
  14. assemblyName = test.TypeInfo.Assembly.FullName.Substring(0, test.TypeInfo.Assembly.FullName.IndexOf(',')).TrimEnd(',');
  15. return ExpectedValue.Equals(assemblyName, StringComparison.OrdinalIgnoreCase);
  16. }
  17. protected override string ElementName
  18. {
  19. get { return "id"; }
  20. }
  21. }
  22. }