private void TestStartingWithMacroOperationSingle(Type t, int rounds) { for (int i = 0; i < rounds; i++) { MacroOpBase raw = (MacroOpBase)RandomPropertyGenerator.Create(t); ICommand cmd = raw.ToCommand(); bool nullCommand = cmd == null; bool shouldBeNull = expectedNullCommand.Contains(t); //Assert.Equal(shouldBeNull, nullCommand); // TODO - reenable this once possible if (shouldBeNull || nullCommand) { continue; } var serCmd = cmd as SerializableCommandBase; // TODO - this shouldnt be needed once all Commands have appropriate macro stuff set Assert.NotNull(serCmd); MacroOpBase entry = serCmd.ToMacroOps().Single(); if (entry == null) { throw new Exception("Deserialized not implemented"); } if (!t.GetTypeInfo().IsAssignableFrom(entry.GetType())) { throw new Exception("Deserialized operation of wrong type"); } RandomPropertyGenerator.AssertAreTheSame(raw, entry); } }