thelinuxlich/artemis_CSharp — pull request #61 by Maximusya (2013-12-26 15:27:53+00:00)
Title: Throw Exceptions on Bit overflow when Int32 is used

There are conditional compilation symbols that force Artemis to use either *Int32* or *BigInteger* types for **ComponentType.Bit** and **EntitySystem.SystemBit**:

```#if XBOX || WINDOWS_PHONE || PORTABLE || FORCEINT32```

But Bit generation is based on left-shift operation that do not cause overflow exceptions even if run in checked mode.
So if a user adds 33rd ComponentType or 33rd EntitySystem - she will not get the expected Bit (ComponentType will get 0 Bit, EntitySystem will get 1 Bit - implementation details), and something may stuck or explode in the EntityWorld :)

Proposed changes:
- throw InvalidOperationException when ComponentType.Bit is Int32 and user tries to add 33rd Component type;
- throw InvalidOperationException when SystemBitManager uses Int32 as SystemBit and user tries to add 33rd EntitySystem instance.

Notes:
- ComponentType uses static fields for Bit generation - thus the test is using Reflection to reset the state;
- added *InternalsVisibleTo* attribute to XNA_INDEPENDANT assembly to unit-test some internals (probably Travis CI will fail - not sure which project it will test)