← Back to team overview

nunit-core team mailing list archive

[Bug 1082330] Re: Better Exception if SetCulture attribute is applied multiple times

 

My intent in 3.0 is that multiple instances (and possibly comma-
separated values in a single instance) should cause the test to run
multiple times, using each of the cultures specified. So, [SetCulture
("en-US"), SetCulture("fr-FR")] would run the test twice, once using the
US English culture and once using French.

Comma-separated values are an easy alternative syntax requiring less
typing.

A few added considerations...

1.  For 3.0, I'd actually prefer to change the name from SetCulture to
Culture, but there is already a Culture attribute with different
semantics. I have a plan for this and I'll publish it for review
shortly.

2. Everything stated about SetCulture also applies to SetUICulture.

3. Probably I should go ahead and apply the 2.6/nunitlite solution to
3.0 first, planning on moving to a more permanent solution later.

Charlie

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1082330

Title:
  Better Exception if SetCulture attribute is applied multiple times

Status in NUnit Test Framework:
  Triaged
Status in NUnitLite Testing Framework:
  Triaged
Status in NUnit V2 Test Framework:
  Triaged

Bug description:
  The following exception is throw If I accidentally apply twice a
  SetCulture attribute to a test case. It would be nice if the exception
  message would point to the cause of the problem.

  System.ArgumentException: An entry with the same key already exists.
  Server stack trace: at
  System.Collections.Specialized.ListDictionary.Add(Object key, Object
  value) at NUnit.Core.NUnitFramework.ApplyCommonAttributes(Attribute[]
  attributes, Test test) at
  NUnit.Core.Builders.NUnitTestCaseBuilder.BuildSingleTestMethod(MethodInfo
  method, Test parentSuite, ParameterSet parms) at
  NUnit.Core.Builders.NUnitTestCaseBuilder.BuildFrom(MethodInfo method,
  Test parentSuite) at
  NUnit.Core.Extensibility.TestCaseBuilderCollection.BuildFrom(MethodInfo
  method, Test suite) at
  NUnit.Core.Builders.NUnitTestFixtureBuilder.AddTestCases(Type
  fixtureType) at
  NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildSingleFixture(Type
  type, Attribute attr) at
  NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildFrom(Type type) at
  NUnit.Core.Extensibility.SuiteBuilderCollection.BuildFrom(Type type)
  at NUnit.Core.TestFixtureBuilder.BuildFrom(Type type) at
  NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly,
  String ns) at NUnit.Core.Builders.TestAssemblyBuilder.Build(String
  assemblyName, Boolean autoSuites) at
  NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName,
  String testName, Boolean autoSuites) at
  NUnit.Core.TestSuiteBuilder.Build(TestPackage package) at
  NUnit.Core.SimpleTestRunner.Load(TestPackage package) at
  NUnit.Core.ProxyTestRunner.Load(TestPackage package) at
  NUnit.Core.ProxyTestRunner.Load(TestPackage package) at
  NUnit.Core.RemoteTestRunner.Load(TestPackage package) at
  System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
  md, Object[] args, Object server, Object[]& outArgs) at
  System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage
  msg)

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunit-3.0/+bug/1082330/+subscriptions