Removed the few old tests

This commit is contained in:
lukeIam committed 2018-03-15 13:52:40 +01:00
1 parent 48975b1ab5
commit 38accc87c3
14 files changed
+8 -1562

No files matched your search

+8
View File
@@ -29,7 +29,10 @@
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">ALWAYS</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_COMPLEX_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_EMBEDDED_STATEMENT_ON_SAME_LINE/@EntryValue">NEVER</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AROUND_MULTIPLICATIVE_OP/@EntryValue">True</s:Boolean>
@@ -117,7 +120,12 @@ along with $SOLUTION$. If not, see &lt;http://www.gnu.org/licenses/&gt;.</s:Stri
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=8cff90ce_002Def0d_002D436d_002Db8f2_002D5b5bdb923d3b/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Classes"&gt;&lt;ElementKinds&gt;&lt;Kind Name="CLASS" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="C" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=9aa707ae_002Dd4fb_002D4760_002Da649_002Dffcedfabd5dc/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected" Description="Fields (not public)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;Kind Name="METHOD" /&gt;&lt;Kind Name="PROPERTY" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=da335a8d_002D4b6e_002D4df6_002D8434_002D29ffe5e2547b/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Structs"&gt;&lt;ElementKinds&gt;&lt;Kind Name="STRUCT" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="S" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/UnitTesting/DisabledProviders/=MSTest/@EntryIndexedValue">False</s:Boolean>
-21
View File
@@ -1,21 +0,0 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace VocaluxeTests
{
static class CTestHelpers
{
public static void AssertFail<T>(Action test) where T : Exception
{
try
{
test.Invoke();
Assert.Fail("Exception " + typeof(T).Name + " not thrown!");
}
catch (Exception e)
{
Assert.IsInstanceOfType(e, typeof(T));
}
}
}
}
-75
View File
@@ -1,75 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using VocaluxeLib.Utils.Combinatorics;
namespace VocaluxeTests
{
[TestClass]
public class CCombinatoricsTest
{
[TestMethod]
public void TestCounts()
{
Assert.AreEqual(4, CCombinations<int>.Count(4, 3));
Assert.AreEqual(6, CCombinations<int>.Count(4, 2));
Assert.AreEqual(66, CCombinations<int>.Count(12, 2));
// Corner cases
for (int i = 1; i < 12; i++)
{
Assert.AreEqual(1, CCombinations<int>.Count(i, 0));
Assert.AreEqual(1, CCombinations<int>.Count(i, i));
Assert.AreEqual(0, CCombinations<int>.Count(i, i + 1));
}
// Check identity (n k) = (n n-k)
for (int i = 0; i <= 12; i++)
Assert.AreEqual(CCombinations<int>.Count(12, i), CCombinations<int>.Count(12, 12 - i));
CTestHelpers.AssertFail<ArgumentException>(() => CCombinations<int>.Count(-1, -1));
CTestHelpers.AssertFail<ArgumentException>(() => CCombinations<int>.Count(-1, 1));
CTestHelpers.AssertFail<ArgumentException>(() => CCombinations<int>.Count(1, -1));
}
// ReSharper disable UnusedParameter.Local
private static void _CheckResults<T>(CCombinations<T> combs, List<T> input)
// ReSharper restore UnusedParameter.Local
{
List<List<T>> results = new List<List<T>>();
foreach (List<T> comb in combs)
{
foreach (List<T> other in results)
Assert.IsFalse(other.SequenceEqual(comb), "Result must be unique");
for (int i = 0; i < comb.Count - 1; i++)
{
Assert.IsTrue(comb.IndexOf(comb[i], i + 1) < 0, "Repetition not allowed");
Assert.IsTrue(input.Contains(comb[i]), "Output must be in input sequence");
}
results.Add(comb);
}
Assert.AreEqual(combs.Count(), results.Count);
List<List<T>> results2 = combs.GetAll();
Assert.AreEqual(results.Count, results2.Count);
for (int i = 0; i < results2.Count; i++)
Assert.IsTrue(results[i].SequenceEqual(results2[i]));
}
[TestMethod]
public void TestResults()
{
Random rand = new Random();
for (int n = 0; n < 8; n++)
{
for (int k = 0; k <= n; k++)
{
List<int> collection = new List<int>(n);
int r = rand.Next(1000);
for (int i = 0; i < n; i++)
collection.Add(i + r);
CCombinations<int> combs = new CCombinations<int>(collection, k);
Assert.AreEqual(CCombinations<int>.Count(n, k), combs.Count());
_CheckResults(combs, collection);
}
}
}
}
}
-73
View File
@@ -1,73 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Vocaluxe.Base;
using Vocaluxe.Reporting;
using VocaluxeLib;
using VocaluxeLib.Log;
using VocaluxeLib.PartyModes.Challenge;
namespace VocaluxeTests
{
[TestClass]
public class CPartyModeTests
{
[TestMethod]
public void TestRoundBoundaries()
{
// ReSharper disable ObjectCreationAsStatement
new CChallengeRounds(1, 1, 1); // Should succeed
// ReSharper restore ObjectCreationAsStatement
for (int inv = -1; inv <= 0; inv++)
{
int invL = inv;
CTestHelpers.AssertFail<ArgumentException>(() => new CChallengeRounds(invL, 1, 1));
CTestHelpers.AssertFail<ArgumentException>(() => new CChallengeRounds(1, invL, 1));
CTestHelpers.AssertFail<ArgumentException>(() => new CChallengeRounds(1, 1, invL));
}
}
private static void _CheckRounds(CChallengeRounds rounds, int numPlayer)
{
List<int> numSongs = new List<int>(numPlayer);
for (int i = 0; i < numPlayer; i++)
numSongs.Add(0);
for (int i = 0; i < rounds.Count; i++)
{
foreach (int player in rounds[i].Players)
{
Assert.IsTrue(player >= 0 && player < numPlayer);
numSongs[player]++;
}
}
Assert.IsTrue(numSongs.Min() == numSongs.Max(), "Some players have more songs than others");
}
[TestMethod]
public void TestRoundGeneration()
{
CBase.Game = new CBGame();
CLog.Init(CSettings.FolderNameLogs, CSettings.FileNameMainLog, CSettings.FileNameSongLog, CSettings.FileNameCrashMarker, CSettings.GetFullVersionText(), CReporter.ShowReporterFunc);
for (int i = 0; i < 10; i++)
{
for (int numPlayer = 1; numPlayer <= 20; numPlayer++)
{
for (int numMic = 1; numMic <= 6; numMic++)
{
int roundFactor = (numPlayer % numMic == 0) ? numPlayer / numMic : numPlayer;
for (int numRounds = roundFactor; numRounds <= 100 && numRounds <= roundFactor * 5; numRounds += roundFactor)
{
CChallengeRounds rounds = new CChallengeRounds(numRounds, numPlayer, numMic);
Assert.IsTrue(rounds.Count >= numRounds);
_CheckRounds(rounds, numPlayer);
if (rounds.Count != numRounds)
CLog.Debug("Number of rounds does not match. Expected: " + numRounds + ", Is: " + rounds.Count + " for " + numPlayer + "/" +
((numPlayer < numMic) ? numPlayer : numMic));
}
}
}
}
}
}
}
-39
View File
@@ -1,39 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über folgende
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("VocaluxeTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VocaluxeTests")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Wenn ComVisible auf "false" festgelegt wird, sind die Typen innerhalb dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("3bdc6da5-a651-452e-903c-deec310288ad")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// durch Einsatz von '*', wie in nachfolgendem Beispiel:
// [Assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="language">Deutsch</string>
<string name="TR_PROGRAM_NAME">Vocaluxe</string>
<string name="TR_GENERAL_AND">und</string>
<string name="TR_BUTTON_EXIT">Exit</string>
<string name="TR_BUTTON_SAVE">Speichern</string>
<string name="TR_BUTTON_BACK">Zurück</string>
<string name="TR_BUTTON_START">Start</string>
<string name="TR_DEBUG_AUDIO_STREAMS">Audio-Streams</string>
<string name="TR_DEBUG_VIDEO_STREAMS">Video-Streams</string>
<string name="TR_DEBUG_TEXTURES">Textures</string>
<string name="TR_DEBUG_TONE_ABS">ToneAbs</string>
<string name="TR_DEBUG_MAX_VOLUME">Max. Volume</string>
<string name="TR_DEBUG_SONGS">Geladene Songs</string>
<string name="TR_DEBUG_MOUSE">Maus</string>
<string name="TR_DEBUG_MEMORY">Speicherverbrauch</string>
<string name="TR_GAMEMODE_NORMAL">Normal</string>
<string name="TR_GAMEMODE_DUET">Duett</string>
<string name="TR_GAMEMODE_MEDLEY">Medley</string>
<string name="TR_GAMEMODE_SHORTSONG">Kurz-Version</string>
<string name="TR_RATING_VOCAL_HERO">Vocal Hero</string>
<string name="TR_RATING_SUPERSTAR">Superstar</string>
<string name="TR_RATING_LEAD_SINGER">Hit-Künstler</string>
<string name="TR_RATING_RISING_STAR">Sternchen</string>
<string name="TR_RATING_HOPEFUL">Fortgeschritten</string>
<string name="TR_RATING_WANNABE">Möchtegern</string>
<string name="TR_RATING_AMATEUR">Amateur</string>
<string name="TR_RATING_TONE_DEAF">Nichtskönner</string>
<string name="TR_USERROLE_GUEST">Gast</string>
<string name="TR_USERROLE_NORMAL">Normaler Benutzer</string>
<string name="TR_USERROLE_ADMIN">Administrator</string>
<string name="TR_USERROLE_KEYBOARDUSER">Tastatur</string>
</resources>
-97
View File
@@ -1,97 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<Info />
<Debug>
<DebugLevel>TR_CONFIG_LEVEL_MAX</DebugLevel>
<SaveModifiedSongs>TR_CONFIG_ON</SaveModifiedSongs>
</Debug>
<Graphics>
<Renderer>TR_CONFIG_DIRECT3D</Renderer>
<TextureQuality>TR_CONFIG_TEXTURE_HIGH</TextureQuality>
<CoverSize>128</CoverSize>
<ScreenW>1024</ScreenW>
<ScreenH>576</ScreenH>
<ScreenAlignment>Middle</ScreenAlignment>
<BorderLeft>0</BorderLeft>
<BorderRight>1</BorderRight>
<BorderTop>0</BorderTop>
<BorderBottom>0</BorderBottom>
<AAMode>X0</AAMode>
<MaxFPS>60</MaxFPS>
<VSync>TR_CONFIG_ON</VSync>
<FullScreen>TR_CONFIG_OFF</FullScreen>
<FadeTime>0.4</FadeTime>
</Graphics>
<Theme>
<Name>Ambient</Name>
<Skin>Blue</Skin>
<Cover>Blue</Cover>
<DrawNoteLines>TR_CONFIG_ON</DrawNoteLines>
<DrawToneHelper>TR_CONFIG_ON</DrawToneHelper>
<TimerLook>TR_CONFIG_TIMERLOOK_EXPANDED</TimerLook>
<PlayerInfo>TR_CONFIG_PLAYERINFO_BOTH</PlayerInfo>
<FadePlayerInfo>TR_CONFIG_FADEPLAYERINFO_OFF</FadePlayerInfo>
<CoverLoading>TR_CONFIG_COVERLOADING_ATSTART</CoverLoading>
<LyricStyle>Slide</LyricStyle>
</Theme>
<Sound>
<PlayBackLib>GstreamerSharp</PlayBackLib>
<RecordLib>PortAudio</RecordLib>
<AudioBufferSize>B2048</AudioBufferSize>
<AudioLatency>0</AudioLatency>
<BackgroundMusic>TR_CONFIG_ON</BackgroundMusic>
<BackgroundMusicVolume>20</BackgroundMusicVolume>
<BackgroundMusicSource>TR_CONFIG_NO_OWN_MUSIC</BackgroundMusicSource>
<BackgroundMusicUseStart>TR_CONFIG_ON</BackgroundMusicUseStart>
<PreviewMusicVolume>50</PreviewMusicVolume>
<GameMusicVolume>100</GameMusicVolume>
</Sound>
<Game>
<Language>Deutsch</Language>
<SongFolder>E:\Songs</SongFolder>
<SongMenu>TR_CONFIG_TILE_BOARD</SongMenu>
<SongSorting>TR_CONFIG_ARTIST_LETTER</SongSorting>
<IgnoreArticles>TR_CONFIG_ON</IgnoreArticles>
<ScoreAnimationTime>10</ScoreAnimationTime>
<TimerMode>TR_CONFIG_TIMERMODE_REMAINING</TimerMode>
<NumPlayers>1</NumPlayers>
<Tabs>TR_CONFIG_ON</Tabs>
<LyricsPosition>TR_CONFIG_LYRICSPOSITION_BOTTOM</LyricsPosition>
<MinLineBreakTime>0.1</MinLineBreakTime>
<Players>
<Player>guest1.xml</Player>
<Player>guest1.xml</Player>
<Player>guest1.xml</Player>
<Player>guest1.xml</Player>
<Player />
<Player />
</Players>
</Game>
<Video>
<VideoDecoder>FFmpeg</VideoDecoder>
<VideoBackgrounds>TR_CONFIG_ON</VideoBackgrounds>
<VideoPreview>TR_CONFIG_ON</VideoPreview>
<VideosInSongs>TR_CONFIG_ON</VideosInSongs>
<VideosToBackground>TR_CONFIG_ON</VideosToBackground>
<WebcamLib>OpenCV</WebcamLib>
<WebcamConfig>
<MonikerString />
<Framerate>0</Framerate>
<Width>0</Width>
<Height>0</Height>
</WebcamConfig>
</Video>
<Record>
<MicConfig>
<DeviceName>Mikrofon (C-Media USB Headphone Set )</DeviceName>
<DeviceDriver>Mikrofon (C-Media USB Headphone Set )6</DeviceDriver>
<Channel>1</Channel>
</MicConfig>
<MicDelay>120</MicDelay>
</Record>
<Server>
<ServerActive>TR_CONFIG_ON</ServerActive>
<ServerEncryption>TR_CONFIG_ON</ServerEncryption>
<ServerPort>3000</ServerPort>
</Server>
</root>
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<Fonts>
<Font>
<Name>Normal</Name>
<Outline>0</Outline>
<OutlineColor>
<R>0</R>
<G>0</G>
<B>0</B>
<A>1</A>
</OutlineColor>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font>
<Font>
<Name>Outline</Name>
<Outline>0.1</Outline>
<OutlineColor>
<R>0</R>
<G>0</G>
<B>0</B>
<A>1</A>
</OutlineColor>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font>
</Fonts>
</root>
-268
View File
@@ -1,268 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<SkinSystemVersion>4</SkinSystemVersion>
<Info>
<Name>Blue</Name>
<Author>bohning</Author>
<VersionMajor>0</VersionMajor>
<VersionMinor>0</VersionMinor>
</Info>
<Colors>
<Player1>
<R>0</R>
<G>0</G>
<B>1</B>
<A>1</A>
</Player1>
<Player2>
<R>1</R>
<G>0</G>
<B>0</B>
<A>1</A>
</Player2>
<Player3>
<R>0</R>
<G>1</G>
<B>0</B>
<A>1</A>
</Player3>
<Player4>
<R>0.5</R>
<G>0</G>
<B>1</B>
<A>1</A>
</Player4>
<Player5>
<R>1</R>
<G>0.8</G>
<B>0</B>
<A>1</A>
</Player5>
<Player6>
<R>1</R>
<G>0</G>
<B>0.5</B>
<A>1</A>
</Player6>
<BackgroundColor>
<R>0</R>
<G>0</G>
<B>0.75</B>
<A>1</A>
</BackgroundColor>
<StaticColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>1</A>
</StaticColor>
<StaticColorAlpha>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>0.5</A>
</StaticColorAlpha>
<StaticWarningColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>0.6</A>
</StaticWarningColor>
<ButtonColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>0.3</A>
</ButtonColor>
<ButtonSelColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>1</A>
</ButtonSelColor>
<ButtonTextColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>0.5</A>
</ButtonTextColor>
<ButtonTextSelColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>1</A>
</ButtonTextSelColor>
<SelectSlideColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>1</A>
</SelectSlideColor>
<SelectSlideColorAlpha>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>0.5</A>
</SelectSlideColorAlpha>
<SelectSlideSelColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>0.5</A>
</SelectSlideSelColor>
<ArrowColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>0.3</A>
</ArrowColor>
<ArrowSelColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>1</A>
</ArrowSelColor>
<TextColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>0.5</A>
</TextColor>
<TextSelColor>
<R>0.675</R>
<G>0.89</G>
<B>0.969</B>
<A>1</A>
</TextSelColor>
<TextWarningColor>
<R>1</R>
<G>0</G>
<B>0</B>
<A>1</A>
</TextWarningColor>
<Black>
<R>0</R>
<G>0</G>
<B>0</B>
<A>1</A>
</Black>
<White>
<R>1</R>
<G>1</G>
<B>1</B>
<A>1</A>
</White>
<Visible>
<R>1</R>
<G>1</G>
<B>1</B>
<A>1</A>
</Visible>
<Invisible>
<R>1</R>
<G>1</G>
<B>1</B>
<A>0</A>
</Invisible>
<LyricProcessedColor>
<R>0</R>
<G>0</G>
<B>1</B>
<A>1</A>
</LyricProcessedColor>
<LyricMainColor>
<R>0</R>
<G>0</G>
<B>0</B>
<A>1</A>
</LyricMainColor>
<LyricSubColor>
<R>0.3</R>
<G>0.3</G>
<B>0.3</B>
<A>1</A>
</LyricSubColor>
<LyricHelper>
<R>0</R>
<G>0</G>
<B>1</B>
<A>0.5</A>
</LyricHelper>
<TimeBar>
<R>0.8</R>
<G>0.95</G>
<B>1</B>
<A>0.5</A>
</TimeBar>
<TimeBarSentence>
<R>0.8</R>
<G>0.95</G>
<B>1</B>
<A>0.85</A>
</TimeBarSentence>
</Colors>
<Skins>
<BG_Default>[Blue]BG_Default.png</BG_Default>
<BG_Options>[Blue]BG_Options.png</BG_Options>
<Menu>Menu.png</Menu>
<Button>Button.png</Button>
<CoverTile>CoverTile.png</CoverTile>
<CoverBackground>CoverBackground.png</CoverBackground>
<Cursor>Cursor.png</Cursor>
<TimeBar>TimeBar.png</TimeBar>
<TimeLine>TimeLine.png</TimeLine>
<Pointer>Pointer.png</Pointer>
<SelectSlide>SelectSlide.png</SelectSlide>
<SelectSlidePlayer>SelectSlidePlayer.png</SelectSlidePlayer>
<SelectSlideArrowLeft>SelectSlideArrowLeft.png</SelectSlideArrowLeft>
<SelectSlideArrowRight>SelectSlideArrowRight.png</SelectSlideArrowRight>
<NoteLeft>notes_left.png</NoteLeft>
<NoteMiddle>notes_mid.png</NoteMiddle>
<NoteRight>notes_right.png</NoteRight>
<NoteBackgroundLeft>notes_bg_left.png</NoteBackgroundLeft>
<NoteBackgroundMiddle>notes_bg_mid.png</NoteBackgroundMiddle>
<NoteBackgroundRight>notes_bg_right.png</NoteBackgroundRight>
<PointsBar>points_bar.png</PointsBar>
<PointsBarBG>points_bar_bg.png</PointsBarBG>
<Lyrics>Lyrics.png</Lyrics>
<LyricHelper>LyricHelper.png</LyricHelper>
<ToneHelper>ToneHelper.png</ToneHelper>
<TextBG>TextBG.png</TextBG>
<Score>Score.png</Score>
<Star>Star.png</Star>
<Snowflake>Snowflake.png</Snowflake>
<SongMenu>SongMenu.png</SongMenu>
<PerfectNoteStar>PerfectNoteStar.png</PerfectNoteStar>
<PauseBG>Pause.png</PauseBG>
<EnergyBeam>EnergyBeam.png</EnergyBeam>
<DuetIcon>DuetIcon.png</DuetIcon>
<VideoIcon>VideoIcon.png</VideoIcon>
<VideoIconCO>VideoIconCO.png</VideoIconCO>
<VideoIconBG>VideoIconBG.png</VideoIconBG>
<MedleyCalcIcon>MedleyCalcIcon.png</MedleyCalcIcon>
<MedleyTagIcon>MedleyTagIcon.png</MedleyTagIcon>
<PlayerSelector>PlayerSelector.png</PlayerSelector>
<PreviousIcon>PreviousIcon.png</PreviousIcon>
<NextIcon>NextIcon.png</NextIcon>
<PlayIcon>PlayIcon.png</PlayIcon>
<PauseIcon>PauseIcon.png</PauseIcon>
<RepeatIcon>RepeatIcon.png</RepeatIcon>
<SongMenuBG>SongMenuBG.png</SongMenuBG>
<CloseIcon>Close.png</CloseIcon>
<DeleteIcon>Delete.png</DeleteIcon>
<SaveIcon>Save.png</SaveIcon>
<SingIcon>Sing.png</SingIcon>
<Minus>Minus.png</Minus>
<Plus>Plus.png</Plus>
<Random>Random.png</Random>
<PopupBG>Popup.png</PopupBG>
<ScrollUp>ScrollUp.png</ScrollUp>
<ScrollDown>ScrollDown.png</ScrollDown>
</Skins>
<Videos>
<BG_Video>[Blue]BG_Video.mp4</BG_Video>
<IntroIn>[Blue]IntroIn.mp4</IntroIn>
<IntroMid>[Blue]IntroMid.mp4</IntroMid>
<IntroOut>[Blue]IntroOut.mp4</IntroOut>
</Videos>
</root>
-16
View File
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<ThemeSystemVersion>5</ThemeSystemVersion>
<Info>
<Name>Ambient</Name>
<Author>bohning</Author>
<VersionMajor>0</VersionMajor>
<VersionMinor>2</VersionMinor>
</Info>
<Cursor>
<Skin>Cursor</Skin>
<W>40</W>
<H>40</H>
<Color Name="StaticColor" />
</Cursor>
</root>
@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<Info>
<Name>Blue</Name>
<Folder>Blue</Folder>
<Author>flokuep</Author>
</Info>
<CoverGenerator Type="Default">
<Text>
<Text>%TEXT%</Text>
<Font>
<Name>Normal</Name>
<Style>Bold</Style>
<Size>500</Size>
</Font>
<Color>
<R>1</R>
<G>1</G>
<B>1</B>
<A>0.8</A>
</Color>
<Margin Default="24">
<Left>24</Left>
</Margin>
<Indent>100</Indent>
</Text>
<BackgroundColor>
<R>1</R>
<G>1</G>
<B>1</B>
<A>1</A>
</BackgroundColor>
<Image>EmptyCover.png</Image>
<ImageAlpha>0.75</ImageAlpha>
<ShowFirstCover>True</ShowFirstCover>
</CoverGenerator>
</root>
-256
View File
@@ -1,256 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Screen>
<Informations>
<ScreenName>ScreenMain</ScreenName>
<ScreenVersion>2</ScreenVersion>
</Informations>
<Backgrounds>
<Background Name="Background1">
<Type>Video</Type>
<SlideShowTextures />
<Video>BG_Video</Video>
<Skin>BG_Default</Skin>
<Color Name="BackgroundColor" />
</Background>
</Backgrounds>
<Statics>
<Static Name="StaticMenuBar">
<Skin>Menu</Skin>
<Color Name="Invisible" />
<Rect>
<X>49</X>
<Y>32</Y>
<W>1181</W>
<H>50</H>
<Z>0</Z>
</Rect>
</Static>
<Static Name="StaticWarningProfiles">
<Skin>TextBG</Skin>
<Color Name="StaticWarningColor" />
<Rect>
<X>150</X>
<Y>610</Y>
<W>355</W>
<H>30</H>
<Z>-1.9</Z>
</Rect>
</Static>
</Statics>
<Texts>
<Text Name="TextRelease">
<X>10</X>
<Y>690</Y>
<Z>-1</Z>
<H>15</H>
<MaxW>0</MaxW>
<Color Name="White" />
<SelColor Name="White" />
<Align>Left</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Normal</Style>
<Font>Normal</Font>
<Text>Vocaluxe "Shining Heaven" v0.3.0 (x64) Beta (0083)</Text>
</Text>
<Text Name="TextWarningProfiles">
<X>320</X>
<Y>612</Y>
<Z>-2</Z>
<H>27</H>
<MaxW>355</MaxW>
<Color Name="TextWarningColor" />
<SelColor Name="TextWarningColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_SCREENMAIN_TEXT_NOPROFILES</Text>
</Text>
</Texts>
<Buttons>
<Button Name="ButtonSing">
<Skin>Button</Skin>
<SkinSelected>Button</SkinSelected>
<Rect>
<X>145</X>
<Y>600</Y>
<W>150</W>
<H>50</H>
<Z>0</Z>
</Rect>
<Color Name="ButtonColor" />
<SelColor Name="ButtonSelColor" />
<Text Name="Text">
<X>75</X>
<Y>12</Y>
<Z>0</Z>
<H>27</H>
<MaxW>142</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_SCREENMAIN_BUTTON_SING</Text>
</Text>
<Reflection>
<Height>26</Height>
<Space>10</Space>
</Reflection>
<SelReflection>
<Height>26</Height>
<Space>10</Space>
</SelReflection>
</Button>
<Button Name="ButtonParty">
<Skin>Button</Skin>
<SkinSelected>Button</SkinSelected>
<Rect>
<X>355</X>
<Y>600</Y>
<W>150</W>
<H>50</H>
<Z>0</Z>
</Rect>
<Color Name="ButtonColor" />
<SelColor Name="ButtonSelColor" />
<Text Name="Text">
<X>75</X>
<Y>12</Y>
<Z>0</Z>
<H>27</H>
<MaxW>142</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_SCREENMAIN_BUTTON_PARTY</Text>
</Text>
<Reflection>
<Height>26</Height>
<Space>10</Space>
</Reflection>
<SelReflection>
<Height>26</Height>
<Space>10</Space>
</SelReflection>
</Button>
<Button Name="ButtonOptions">
<Skin>Button</Skin>
<SkinSelected>Button</SkinSelected>
<Rect>
<X>565</X>
<Y>600</Y>
<W>150</W>
<H>50</H>
<Z>0</Z>
</Rect>
<Color Name="ButtonColor" />
<SelColor Name="ButtonSelColor" />
<Text Name="Text">
<X>75</X>
<Y>12</Y>
<Z>0</Z>
<H>27</H>
<MaxW>142</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_SCREENMAIN_BUTTON_OPTIONS</Text>
</Text>
<Reflection>
<Height>26</Height>
<Space>10</Space>
</Reflection>
<SelReflection>
<Height>26</Height>
<Space>10</Space>
</SelReflection>
</Button>
<Button Name="ButtonProfiles">
<Skin>Button</Skin>
<SkinSelected>Button</SkinSelected>
<Rect>
<X>775</X>
<Y>600</Y>
<W>150</W>
<H>50</H>
<Z>0</Z>
</Rect>
<Color Name="ButtonColor" />
<SelColor Name="ButtonSelColor" />
<Text Name="Text">
<X>75</X>
<Y>12</Y>
<Z>0</Z>
<H>27</H>
<MaxW>142</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_SCREENMAIN_BUTTON_PROFILES</Text>
</Text>
<Reflection>
<Height>26</Height>
<Space>10</Space>
</Reflection>
<SelReflection>
<Height>26</Height>
<Space>10</Space>
</SelReflection>
</Button>
<Button Name="ButtonExit">
<Skin>Button</Skin>
<SkinSelected>Button</SkinSelected>
<Rect>
<X>985</X>
<Y>600</Y>
<W>150</W>
<H>50</H>
<Z>0</Z>
</Rect>
<Color Name="ButtonColor" />
<SelColor Name="ButtonSelColor" />
<Text Name="Text">
<X>75</X>
<Y>12</Y>
<Z>0</Z>
<H>27</H>
<MaxW>142</MaxW>
<Color Name="ButtonTextColor" />
<SelColor Name="ButtonTextSelColor" />
<Align>Center</Align>
<ResizeAlign>Center</ResizeAlign>
<Style>Bold</Style>
<Font>Outline</Font>
<Text>TR_BUTTON_EXIT</Text>
</Text>
<Reflection>
<Height>26</Height>
<Space>10</Space>
</Reflection>
<SelReflection>
<Height>26</Height>
<Space>10</Space>
</SelReflection>
</Button>
</Buttons>
<SongMenus />
<Lyrics />
<SelectSlides />
<SingNotes />
<NameSelections />
<Equalizers />
<Playlists />
<ParticleEffects />
<ScreenSettings />
</Screen>
-121
View File
@@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{93356718-3A0B-4784-AAE1-215065BFFC66}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VocaluxeTests</RootNamespace>
<AssemblyName>VocaluxeTests</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.XML" />
<Reference Include="VocaluxeLib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Output\libs\managed\VocaluxeLib.dll</HintPath>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="CTestHelpers.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CombinatoricsTest.cs" />
<Compile Include="PartyModeTests.cs" />
<Compile Include="XmlSerializerTest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PartyModes\PartyModeChallenge\PartyModeChallenge.csproj">
<Project>{5a4053f1-5ad5-441f-b254-d97a088127b6}</Project>
<Name>PartyModeChallenge</Name>
</ProjectReference>
<ProjectReference Include="..\Vocaluxe\Vocaluxe.csproj">
<Project>{2a1e0f2d-5392-4bb7-b0a1-a9dfa13e79ff}</Project>
<Name>Vocaluxe</Name>
</ProjectReference>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-490
View File
@@ -1,490 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Xml.Serialization;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Vocaluxe.Base;
using VocaluxeLib;
using VocaluxeLib.Menu;
using VocaluxeLib.Xml;
namespace VocaluxeTests
{
[TestClass]
public class CXmlSerializerTest
{
private const string _Head = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n";
private const string _Empty = _Head + @"<root />";
#pragma warning disable 649
#pragma warning disable 169
private struct SBasic
{
public int I;
public string S;
public float F;
public double D;
}
[XmlType("Entry")]
private struct SEntry
{
public int I;
}
private struct SList
{
[XmlArray] public List<SEntry> Ints;
}
private struct SArray
{
[XmlArray] public SEntry[] Ints;
}
private struct SListEmb
{
public int I;
[XmlElement("Entry")] public List<SEntry> Ints;
public int J;
}
private struct SArrayEmb
{
public int I;
[XmlElement("Entry")] public SEntry[] Ints;
public int J;
}
private struct SProperty
{
[XmlIgnore] public int Private;
// ReSharper disable UnusedMember.Local
public int Public
{
get { return Private - 1; }
set { Private = value + 1; }
}
// ReSharper restore UnusedMember.Local
// ReSharper disable UnusedAutoPropertyAccessor.Local
public int Auto { get; set; }
// ReSharper restore UnusedAutoPropertyAccessor.Local
}
private struct SBytes
{
public byte[] B;
}
private struct SIgnore
{
[XmlIgnore] public int I;
public int J;
}
private class CIgnore
{
[XmlIgnore] public int I;
public int J;
}
private struct SDefaultSub
{
[DefaultValue(111)] public int I;
}
private struct SDefault
{
[DefaultValue(1337)] public int I;
[DefaultValue("Foo")] public string S;
public float? F;
[DefaultValue(666.0)] public double D;
public SDefaultSub Sub;
}
#pragma warning restore 169
#pragma warning restore 649
private static void _AssertFail<T, T2>(String xmlString) where T2 : Exception where T : new()
{
var deserializer = new CXmlDeserializer();
CTestHelpers.AssertFail<T2>(() => deserializer.DeserializeString<T>(xmlString));
}
private static T _AssertSerDeserMatch<T>(string xmlString) where T : new()
{
var deserializer = new CXmlDeserializer();
var serializer = new CXmlSerializer();
T foo = deserializer.DeserializeString<T>(xmlString);
string xmlNew = serializer.Serialize(foo);
Assert.AreEqual(xmlString, xmlNew);
return foo;
}
[TestMethod]
public void TestBasic()
{
const string s = @"<root>
<I>1</I>
<S>2</S>
<F>3</F>
<D>4</D>
</root>";
const string sUnordered = @"<root>
<D>4</D>
<I>1</I>
<F>3</F>
<S>2</S>
</root>";
var xml = new CXmlDeserializer();
SBasic foo = xml.DeserializeString<SBasic>(s);
Assert.AreEqual(1, foo.I);
Assert.AreEqual("2", foo.S);
Assert.AreEqual(3, foo.F, 0.0001);
Assert.AreEqual(4, foo.D, 0.0001);
foo = xml.DeserializeString<SBasic>(sUnordered);
Assert.AreEqual(1, foo.I);
Assert.AreEqual("2", foo.S);
Assert.AreEqual(3, foo.F, 0.0001);
Assert.AreEqual(4, foo.D, 0.0001);
}
[TestMethod]
public void TestMissingXmlElement()
{
string[] s = new string[] {@"<root>
<S>2</S>
<F>3</F>
<D>4</D>
</root>", @"<root>
<I>1</I>
<F>3</F>
<D>4</D>
</root>", @"<root>
<I>1</I>
<S>2</S>
<F>3</F>
</root>"};
foreach (string s1 in s)
{
string sTmp = s1;
_AssertFail<SBasic, CXmlException>(sTmp);
}
}
[TestMethod]
public void TestMissingStructElement()
{
string[] s = new string[] {@"<root>
<Foo>1</Foo>
<I>1</I>
<S>2</S>
<F>3</F>
<D>4</D>
</root>", @"<root>
<I>1</I>
<Foo>1</Foo>
<S>2</S>
<F>3</F>
<D>4</D>
</root>", @"<root>
<I>1</I>
<S>2</S>
<F>3</F>
<D>4</D>
<Foo>1</Foo>
</root>"};
foreach (string s1 in s)
{
string sTmp = s1;
_AssertFail<SBasic, CXmlException>(sTmp);
}
}
[TestMethod]
public void TestBasicSerialization()
{
const string s = _Head + @"<root>
<I>1</I>
<S>2</S>
<F>3</F>
<D>4</D>
</root>";
_AssertSerDeserMatch<SBasic>(s);
}
private readonly string[] _XmlList = new string[]
{
_Head + @"<root>
<Ints>
<Entry>
<I>1</I>
</Entry>
<Entry>
<I>1</I>
</Entry>
</Ints>
</root>",
_Head + @"<root>
<Ints>
</Ints>
</root>",
_Head + @"<root>
<Ints />
</root>"
};
[TestMethod]
public void TestList()
{
var xml = new CXmlDeserializer();
var ser = new CXmlSerializer();
SList foo = xml.DeserializeString<SList>(_XmlList[0]);
Assert.AreEqual(foo.Ints.Count, 2, "Deserialization failed");
Assert.AreEqual(foo.Ints[0].I, 1, "Deserialization failed");
Assert.AreEqual(foo.Ints[1].I, 1, "Deserialization failed");
string res = ser.Serialize(foo);
Assert.AreEqual(_XmlList[0], res, "Serialization failed");
foo = xml.DeserializeString<SList>(_XmlList[1]);
Assert.AreEqual(foo.Ints.Count, 0, "Deserialization2 failed");
res = ser.Serialize(foo);
Assert.AreEqual(_XmlList[2], res, "Serialization2 failed");
foo = xml.DeserializeString<SList>(_XmlList[2]);
Assert.AreEqual(foo.Ints.Count, 0, "Deserialization2 failed");
_AssertSerDeserMatch<SList>(_XmlList[2]);
res = ser.Serialize(foo);
Assert.AreEqual(_XmlList[2], res, "Serialization2 failed");
_AssertFail<SList, CXmlException>(_Empty);
}
[TestMethod]
public void TestArray()
{
var xml = new CXmlDeserializer();
var ser = new CXmlSerializer();
SArray foo = xml.DeserializeString<SArray>(_XmlList[0]);
Assert.AreEqual(foo.Ints.Length, 2, "Deserialization failed");
Assert.AreEqual(foo.Ints[0].I, 1, "Deserialization failed");
Assert.AreEqual(foo.Ints[1].I, 1, "Deserialization failed");
string res = ser.Serialize(foo);
Assert.AreEqual(_XmlList[0], res, "Serialization failed");
foo = xml.DeserializeString<SArray>(_XmlList[1]);
Assert.AreEqual(foo.Ints.Length, 0, "Deserialization2 failed");
res = ser.Serialize(foo);
Assert.AreEqual(_XmlList[2], res, "Serialization2 failed");
foo = xml.DeserializeString<SArray>(_XmlList[2]);
Assert.AreEqual(foo.Ints.Length, 0, "Deserialization2 failed");
res = ser.Serialize(foo);
Assert.AreEqual(_XmlList[2], res, "Serialization2 failed");
_AssertFail<SArray, CXmlException>(_Empty);
}
private const string _XmlListEmb = _Head + @"<root>
<I>2</I>
<Entry>
<I>1</I>
</Entry>
<J>3</J>
</root>";
private const string _XmlListEmb2 = _Head + @"<root>
<I>2</I>
<Entry>
<I>1</I>
</Entry>
<Entry>
<I>2</I>
</Entry>
<J>3</J>
</root>";
private const string _XmlListEmb3 = _Head + @"<root>
<I>2</I>
<J>3</J>
</root>";
private const string _XmlListEmb4 = _Head + @"<root>
<I>2</I>
<Entry />
<J>3</J>
</root>";
[TestMethod]
public void TestListEmbedded()
{
var xml = new CXmlDeserializer();
var ser = new CXmlSerializer();
SListEmb foo = xml.DeserializeString<SListEmb>(_XmlListEmb);
Assert.AreEqual(foo.Ints.Count, 1, "Deserialization failed");
Assert.AreEqual(foo.Ints[0].I, 1, "Deserialization failed");
string res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb, res, "Serialization failed");
foo = xml.DeserializeString<SListEmb>(_XmlListEmb2);
Assert.AreEqual(foo.Ints.Count, 2, "Deserialization failed");
Assert.AreEqual(foo.Ints[1].I, 2, "Deserialization failed");
res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb2, res, "Serialization failed");
foo = xml.DeserializeString<SListEmb>(_XmlListEmb3);
Assert.AreEqual(foo.Ints.Count, 0, "Deserialization failed");
res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb3, res, "Serialization failed");
ser = new CXmlSerializer(true);
foo.Ints.Clear();
res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb4, res, "Serialization failed");
_AssertFail<SListEmb, CXmlException>(_Empty);
}
[TestMethod]
public void TestArrayEmbedded()
{
var xml = new CXmlDeserializer();
var ser = new CXmlSerializer();
SArrayEmb foo = xml.DeserializeString<SArrayEmb>(_XmlListEmb);
Assert.AreEqual(foo.Ints.Length, 1, "Deserialization failed");
Assert.AreEqual(foo.Ints[0].I, 1, "Deserialization failed");
string res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb, res, "Serialization failed");
foo = xml.DeserializeString<SArrayEmb>(_XmlListEmb2);
Assert.AreEqual(foo.Ints.Length, 2, "Deserialization failed");
Assert.AreEqual(foo.Ints[1].I, 2, "Deserialization failed");
res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb2, res, "Serialization failed");
foo = xml.DeserializeString<SArrayEmb>(_XmlListEmb3);
Assert.AreEqual(foo.Ints.Length, 0, "Deserialization failed");
res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb3, res, "Serialization failed");
ser = new CXmlSerializer(true);
foo.Ints = new SEntry[0];
res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb4, res, "Serialization failed");
_AssertFail<SArrayEmb, CXmlException>(_Empty);
}
[TestMethod]
public void TestProperty()
{
const string xmlString = _Head + @"<root>
<Public>2</Public>
<Auto>3</Auto>
</root>";
SProperty foo = _AssertSerDeserMatch<SProperty>(xmlString);
Assert.AreEqual(3, foo.Private);
Assert.AreEqual(3, foo.Auto);
}
[TestMethod]
public void TestByteArray()
{
const string xmlString = _Head + @"<root>
<B>MTMzNw==</B>
</root>";
_AssertSerDeserMatch<SBytes>(xmlString);
}
private const string _XmlIgnore = _Head + @"<root>
<J>2</J>
</root>";
private const string _XmlIgnore2 = _Head + @"<root>
<I>2</I>
<J>2</J>
</root>";
[TestMethod]
public void TestIgnore()
{
_AssertSerDeserMatch<SIgnore>(_XmlIgnore);
_AssertFail<SIgnore, CXmlException>(_XmlIgnore2);
}
[TestMethod]
public void TestExisting()
{
var foo = new SIgnore {I = 1};
var xml = new CXmlDeserializer();
var ser = new CXmlSerializer();
SIgnore bar = xml.DeserializeString(_XmlIgnore, foo);
Assert.AreEqual(1, bar.I);
Assert.AreEqual(_XmlIgnore, ser.Serialize(bar));
var foo2 = new CIgnore {I = 1};
CIgnore bar2 = xml.DeserializeString(_XmlIgnore, foo2);
Assert.AreEqual(1, bar2.I);
Assert.AreEqual(foo2.J, bar2.J, "Original classes should be modified by the deserialization");
Assert.AreEqual(_XmlIgnore, ser.Serialize(bar2));
}
[TestMethod]
public void TestOnlyList()
{
const string s = _Head + @"<root>
<String>2</String>
<String>3</String>
</root>";
_AssertSerDeserMatch<List<string>>(s);
}
[TestMethod]
public void TestOnlyDict()
{
const string s = _Head + @"<root>
<String name=""val1"">2</String>
<String name=""val2"">3</String>
</root>";
_AssertSerDeserMatch<Dictionary<string, string>>(s);
}
[TestMethod]
public void TestDefaultValues()
{
const string s = _Head + @"<root>
<I>1</I>
<S>2</S>
<F>3</F>
<D>4</D>
<Sub>
<I>22</I>
</Sub>
</root>";
_AssertSerDeserMatch<SDefault>(s);
var xml = new CXmlDeserializer(new CXmlErrorHandler(exception => { }));
SDefault foo = xml.DeserializeString<SDefault>(@"<root />");
Assert.AreEqual(foo.I, 1337);
Assert.AreEqual(foo.F, null);
Assert.AreEqual(foo.S, "Foo");
Assert.AreEqual(foo.D, 666);
Assert.AreEqual(foo.Sub.I, 111);
string newXml = new CXmlSerializer().Serialize(foo);
Assert.AreEqual(_Head + @"<root>
<Sub />
</root>", newXml);
}
[TestMethod]
public void TestRealFiles()
{
Type[] types = new Type[]
{typeof(SThemeCover), typeof(CConfig.SConfig), typeof(SThemeScreen), typeof(SDefaultFonts), typeof(SSkin), typeof(STheme), typeof(Dictionary<string, string>)};
string filePath = Path.Combine(new string[] {AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", "TestXmlFiles"});
foreach (Type type in types)
{
string xmlPath = Path.Combine(filePath, type.Name + ".xml");
var deser = new CXmlDeserializer();
object foo = null;
try
{
foo = deser.Deserialize(xmlPath, Activator.CreateInstance(type));
}
catch (Exception e)
{
Assert.Fail("Exception with " + type.Name + ": {0}", new object[] {e.Message});
}
Assert.IsInstanceOfType(foo, type, "Wrong type with " + type.Name);
var ser = new CXmlSerializer(type == typeof(CConfig.SConfig));
string newXml = ser.Serialize(foo, type == typeof(Dictionary<string, string>) ? "resources" : null);
// Typename will be uppercase but input is lowercase
newXml = newXml.Replace("<String", "<string").Replace("</String", "</string");
string oldXml = File.ReadAllText(xmlPath);
Assert.AreEqual(oldXml, newXml, "Error with " + type.Name);
}
}
}
}