Skip to content

Commit

Permalink
RandomizerNumber (#4)
Browse files Browse the repository at this point in the history
* Number`[...]

* fix ui

* remove IFieldOptions
  • Loading branch information
StefH committed Nov 9, 2018
1 parent 2357621 commit 9d2180c
Show file tree
Hide file tree
Showing 33 changed files with 239 additions and 415 deletions.
18 changes: 2 additions & 16 deletions Example Project Files/My Table.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<Name>Numbers_Integer</Name>
<FieldOptions xsi:type="FieldOptionsInteger">
<ValueAsString>false</ValueAsString>
<UseNullValues>true</UseNullValues>
<UseNullValues>false</UseNullValues>
<Min>0</Min>
<Max>99999999</Max>
<Max>77778888</Max>
</FieldOptions>
<Field>
<FieldType>Numbers</FieldType>
Expand All @@ -25,20 +25,6 @@
<SubFieldType>Integer</SubFieldType>
</SubField>
</DataField>
<DataField>
<Name>Numbers_IntegerFixed</Name>
<FieldOptions xsi:type="FieldOptionsIntegerFixed">
<ValueAsString>false</ValueAsString>
<UseNullValues>false</UseNullValues>
<Value>77</Value>
</FieldOptions>
<Field>
<FieldType>Numbers</FieldType>
</Field>
<SubField>
<SubFieldType>IntegerFixed</SubFieldType>
</SubField>
</DataField>
<DataField>
<Name>Human_First_Both</Name>
<FieldOptions xsi:type="FieldOptionsFirstName">
Expand Down
16 changes: 15 additions & 1 deletion src/ConsoleAppClassic/MainTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using RandomDataGenerator.FieldOptions;
using RandomDataGenerator.Randomizers;

Expand Down Expand Up @@ -28,10 +29,22 @@ public static void Run()
string firstname = randomizerFirstName.Generate();
Write(randomizerFirstName, firstname);

var randomizerBoolean = RandomizerFactory.GetRandomizer(new FieldOptionsBoolean());
bool? b = randomizerBoolean.Generate();
Write(randomizerBoolean, b);

var randomizerShort = RandomizerFactory.GetRandomizer(new FieldOptionsShort());
short? sh = randomizerShort.Generate();
Write(randomizerShort, sh);

var randomizerInteger = RandomizerFactory.GetRandomizer(new FieldOptionsInteger());
int? integer = randomizerInteger.Generate();
Write(randomizerInteger, integer);

var randomizerDouble = RandomizerFactory.GetRandomizer(new FieldOptionsDouble());
double? dbl = randomizerDouble.Generate();
Write(randomizerDouble, dbl);

var randomizerGuid = RandomizerFactory.GetRandomizer(new FieldOptionsGuid());
Guid? guid = randomizerGuid.Generate();
Write(randomizerGuid, guid);
Expand Down Expand Up @@ -70,7 +83,8 @@ public static void Run()

private static void Write<T>(object randomizer, T value)
{
Console.WriteLine("{0} --> '{1}'", randomizer.GetType().Name, value);
Type genericType = randomizer.GetType().GetTypeInfo().GenericTypeArguments.FirstOrDefault();
Console.WriteLine("{0}{1} --> '{2}'", randomizer.GetType().Name, genericType != null ? $"[{genericType}]" : string.Empty, value);
}
}
}
3 changes: 2 additions & 1 deletion src/RandomDataGenerator Solution.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Lipsum/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Randomizer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Randomizers/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Randomizers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stef/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
17 changes: 5 additions & 12 deletions src/RandomDataGenerator.Gui/Data/DataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,17 @@ public class DataManager

public DataManager()
{
/*
_fields.Add(new Field
{
FieldType = FieldType.None,
SubFields = new []
{
new SubField { SubFieldType = SubFieldType.None }
}
});
*/

_fields.Add(new Field
{
FieldType = FieldType.Numbers,
SubFields = new[]
{
// new SubField { SubFieldType = SubFieldType.Boolean },
// new SubField { SubFieldType = SubFieldType.Short },
new SubField { SubFieldType = SubFieldType.Integer },
new SubField { SubFieldType = SubFieldType.IntegerFixed }
// new SubField { SubFieldType = SubFieldType.Long },
// new SubField { SubFieldType = SubFieldType.Float },
// new SubField { SubFieldType = SubFieldType.Double }
}
});

Expand Down
9 changes: 0 additions & 9 deletions src/RandomDataGenerator.Gui/RandomDataGenerator.Gui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,6 @@
<Compile Include="UserControlsFields\UserControlTextWords.Designer.cs">
<DependentUpon>UserControlTextWords.cs</DependentUpon>
</Compile>
<Compile Include="UserControlsFields\UserControlIntegerFixed.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UserControlsFields\UserControlIntegerFixed.Designer.cs">
<DependentUpon>UserControlIntegerFixed.cs</DependentUpon>
</Compile>
<Compile Include="UserControlsFields\UserControlCity.cs">
<SubType>UserControl</SubType>
</Compile>
Expand Down Expand Up @@ -276,9 +270,6 @@
<EmbeddedResource Include="UserControlsFields\UserControlTextWords.resx">
<DependentUpon>UserControlTextWords.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UserControlsFields\UserControlIntegerFixed.resx">
<DependentUpon>UserControlIntegerFixed.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UserControlsFields\UserControlCity.resx">
<DependentUpon>UserControlCity.cs</DependentUpon>
</EmbeddedResource>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9d2180c

Please sign in to comment.