From 76e67c03957510a3eff206cbf45d192c2bb969c2 Mon Sep 17 00:00:00 2001 From: zgp1001 Date: Tue, 23 Jan 2018 17:55:03 -0500 Subject: [PATCH 1/4] Added Visual Studio projects for main project and tests. --- .gitattributes | 63 +++++ .gitignore | 261 ++++++++++++++++++ MissingNumber/MissingNumber.sln | 28 ++ MissingNumber/MissingNumber/App.config | 6 + MissingNumber/MissingNumber/App.xaml | 9 + MissingNumber/MissingNumber/App.xaml.cs | 17 ++ MissingNumber/MissingNumber/MainWindow.xaml | 12 + .../MissingNumber/MainWindow.xaml.cs | 28 ++ .../MissingNumber/MissingNumber.csproj | 97 +++++++ .../MissingNumber/Properties/AssemblyInfo.cs | 55 ++++ .../Properties/Resources.Designer.cs | 71 +++++ .../MissingNumber/Properties/Resources.resx | 117 ++++++++ .../Properties/Settings.Designer.cs | 30 ++ .../Properties/Settings.settings | 7 + .../MissingNumberTests.csproj | 67 +++++ .../Properties/AssemblyInfo.cs | 20 ++ MissingNumber/MissingNumberTests/UnitTest1.cs | 14 + .../MissingNumberTests/packages.config | 5 + 18 files changed, 907 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 MissingNumber/MissingNumber.sln create mode 100644 MissingNumber/MissingNumber/App.config create mode 100644 MissingNumber/MissingNumber/App.xaml create mode 100644 MissingNumber/MissingNumber/App.xaml.cs create mode 100644 MissingNumber/MissingNumber/MainWindow.xaml create mode 100644 MissingNumber/MissingNumber/MainWindow.xaml.cs create mode 100644 MissingNumber/MissingNumber/MissingNumber.csproj create mode 100644 MissingNumber/MissingNumber/Properties/AssemblyInfo.cs create mode 100644 MissingNumber/MissingNumber/Properties/Resources.Designer.cs create mode 100644 MissingNumber/MissingNumber/Properties/Resources.resx create mode 100644 MissingNumber/MissingNumber/Properties/Settings.Designer.cs create mode 100644 MissingNumber/MissingNumber/Properties/Settings.settings create mode 100644 MissingNumber/MissingNumberTests/MissingNumberTests.csproj create mode 100644 MissingNumber/MissingNumberTests/Properties/AssemblyInfo.cs create mode 100644 MissingNumber/MissingNumberTests/UnitTest1.cs create mode 100644 MissingNumber/MissingNumberTests/packages.config diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c4efe2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,261 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/MissingNumber/MissingNumber.sln b/MissingNumber/MissingNumber.sln new file mode 100644 index 0000000..5c5fc41 --- /dev/null +++ b/MissingNumber/MissingNumber.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26228.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MissingNumber", "MissingNumber\MissingNumber.csproj", "{4A839C5C-A726-4FB4-AB95-D4817D287B99}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MissingNumberTests", "MissingNumberTests\MissingNumberTests.csproj", "{21A516FC-C655-481B-9D19-E97615701CD9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4A839C5C-A726-4FB4-AB95-D4817D287B99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A839C5C-A726-4FB4-AB95-D4817D287B99}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A839C5C-A726-4FB4-AB95-D4817D287B99}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A839C5C-A726-4FB4-AB95-D4817D287B99}.Release|Any CPU.Build.0 = Release|Any CPU + {21A516FC-C655-481B-9D19-E97615701CD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {21A516FC-C655-481B-9D19-E97615701CD9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {21A516FC-C655-481B-9D19-E97615701CD9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {21A516FC-C655-481B-9D19-E97615701CD9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/MissingNumber/MissingNumber/App.config b/MissingNumber/MissingNumber/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/MissingNumber/MissingNumber/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MissingNumber/MissingNumber/App.xaml b/MissingNumber/MissingNumber/App.xaml new file mode 100644 index 0000000..6e008ca --- /dev/null +++ b/MissingNumber/MissingNumber/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/MissingNumber/MissingNumber/App.xaml.cs b/MissingNumber/MissingNumber/App.xaml.cs new file mode 100644 index 0000000..cd56d48 --- /dev/null +++ b/MissingNumber/MissingNumber/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace MissingNumber +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/MissingNumber/MissingNumber/MainWindow.xaml b/MissingNumber/MissingNumber/MainWindow.xaml new file mode 100644 index 0000000..f8a0d4e --- /dev/null +++ b/MissingNumber/MissingNumber/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/MissingNumber/MissingNumber/MainWindow.xaml.cs b/MissingNumber/MissingNumber/MainWindow.xaml.cs new file mode 100644 index 0000000..ed46dea --- /dev/null +++ b/MissingNumber/MissingNumber/MainWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace MissingNumber +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/MissingNumber/MissingNumber/MissingNumber.csproj b/MissingNumber/MissingNumber/MissingNumber.csproj new file mode 100644 index 0000000..de19145 --- /dev/null +++ b/MissingNumber/MissingNumber/MissingNumber.csproj @@ -0,0 +1,97 @@ + + + + + Debug + AnyCPU + {4A839C5C-A726-4FB4-AB95-D4817D287B99} + WinExe + MissingNumber + MissingNumber + v4.5.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + \ No newline at end of file diff --git a/MissingNumber/MissingNumber/Properties/AssemblyInfo.cs b/MissingNumber/MissingNumber/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d92c070 --- /dev/null +++ b/MissingNumber/MissingNumber/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MissingNumber")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MissingNumber")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MissingNumber/MissingNumber/Properties/Resources.Designer.cs b/MissingNumber/MissingNumber/Properties/Resources.Designer.cs new file mode 100644 index 0000000..d90287f --- /dev/null +++ b/MissingNumber/MissingNumber/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace MissingNumber.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MissingNumber.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/MissingNumber/MissingNumber/Properties/Resources.resx b/MissingNumber/MissingNumber/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/MissingNumber/MissingNumber/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MissingNumber/MissingNumber/Properties/Settings.Designer.cs b/MissingNumber/MissingNumber/Properties/Settings.Designer.cs new file mode 100644 index 0000000..e87de8d --- /dev/null +++ b/MissingNumber/MissingNumber/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace MissingNumber.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/MissingNumber/MissingNumber/Properties/Settings.settings b/MissingNumber/MissingNumber/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/MissingNumber/MissingNumber/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/MissingNumber/MissingNumberTests/MissingNumberTests.csproj b/MissingNumber/MissingNumberTests/MissingNumberTests.csproj new file mode 100644 index 0000000..e2ec860 --- /dev/null +++ b/MissingNumber/MissingNumberTests/MissingNumberTests.csproj @@ -0,0 +1,67 @@ + + + + + Debug + AnyCPU + {21A516FC-C655-481B-9D19-E97615701CD9} + Library + Properties + MissingNumberTests + MissingNumberTests + v4.5.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/MissingNumber/MissingNumberTests/Properties/AssemblyInfo.cs b/MissingNumber/MissingNumberTests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c09eea1 --- /dev/null +++ b/MissingNumber/MissingNumberTests/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("MissingNumberTests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MissingNumberTests")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("21a516fc-c655-481b-9d19-e97615701cd9")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MissingNumber/MissingNumberTests/UnitTest1.cs b/MissingNumber/MissingNumberTests/UnitTest1.cs new file mode 100644 index 0000000..ce9436a --- /dev/null +++ b/MissingNumber/MissingNumberTests/UnitTest1.cs @@ -0,0 +1,14 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace MissingNumberTests +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + } + } +} diff --git a/MissingNumber/MissingNumberTests/packages.config b/MissingNumber/MissingNumberTests/packages.config new file mode 100644 index 0000000..1ab7218 --- /dev/null +++ b/MissingNumber/MissingNumberTests/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file From 8fc92e5ec54dc2dec335f4c24ff3a3964475a8c7 Mon Sep 17 00:00:00 2001 From: zgp1001 Date: Tue, 23 Jan 2018 17:58:46 -0500 Subject: [PATCH 2/4] Added code from non-UI (console app) project in. --- MissingNumber/MissingNumber/FileParser.cs | 44 ++++++++++ .../MissingNumber/MissingNumber.csproj | 2 + MissingNumber/MissingNumber/NumberLine.cs | 84 +++++++++++++++++++ .../MissingNumberTests.csproj | 8 +- .../MissingNumberTests/NumberLineTests.cs | 75 +++++++++++++++++ MissingNumber/MissingNumberTests/UnitTest1.cs | 14 ---- 6 files changed, 212 insertions(+), 15 deletions(-) create mode 100644 MissingNumber/MissingNumber/FileParser.cs create mode 100644 MissingNumber/MissingNumber/NumberLine.cs create mode 100644 MissingNumber/MissingNumberTests/NumberLineTests.cs delete mode 100644 MissingNumber/MissingNumberTests/UnitTest1.cs diff --git a/MissingNumber/MissingNumber/FileParser.cs b/MissingNumber/MissingNumber/FileParser.cs new file mode 100644 index 0000000..e604b21 --- /dev/null +++ b/MissingNumber/MissingNumber/FileParser.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.IO; + +namespace MissingNumber +{ + /// + /// Parses a file of the right format and creates NumberLine objects from it + /// + public class FileParser + { + /// + /// Parses a file with the correct format and returns a list of NumberLine objects + /// + /// Full path to the file to read + /// IList of NumberLine objects created from the file + public IList ParseFile(string filePath) + { + if (File.Exists(filePath)) + { + return parseLines(File.ReadAllLines(filePath)); + } + else + { + throw new ArgumentException($"Invalid file passed to FileParser, file {filePath} does not exist."); + } + } + + private IList parseLines(string [] lines) + { + List numberLines = new List(); + foreach (string line in lines) + { + numberLines.Add(parseLine(line)); + } + return numberLines; + } + + private NumberLine parseLine(string line) + { + return new NumberLine(line, ','); + } + } +} diff --git a/MissingNumber/MissingNumber/MissingNumber.csproj b/MissingNumber/MissingNumber/MissingNumber.csproj index de19145..dd02efe 100644 --- a/MissingNumber/MissingNumber/MissingNumber.csproj +++ b/MissingNumber/MissingNumber/MissingNumber.csproj @@ -62,12 +62,14 @@ App.xaml Code + MainWindow.xaml Code + Code diff --git a/MissingNumber/MissingNumber/NumberLine.cs b/MissingNumber/MissingNumber/NumberLine.cs new file mode 100644 index 0000000..b8ddeb8 --- /dev/null +++ b/MissingNumber/MissingNumber/NumberLine.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace MissingNumber +{ + /// + /// Class that represents a sequential list of numbers and provides the ability to detect which number is missing + /// + public class NumberLine + { + private int _sum = 0; + + /// + /// Creats a new NumberLine object + /// + public NumberLine(string line, char delimiter) + { + Min = int.MaxValue; + Max = int.MinValue; + Numbers = populateNumbers(line, delimiter); + } + + /// + /// Collection of Numbers generated, unordered + /// + public IReadOnlyList Numbers { get; private set; } + + /// + /// Smallest Number in sequence + /// + public int Min { get; private set; } + + /// + /// Largest Number in sequence + /// + public int Max { get; private set; } + + /// + /// Determines which number is missing from the sequence of Numbers + /// + /// + /// + /// + public int FindMissingNumber() + { + int expectedSum = (Numbers.Count + 1) * (Min + Max) / 2; + return expectedSum - _sum; + } + + private IReadOnlyList populateNumbers(string line, char delimiter) + { + string[] nums = line.Split(delimiter); + return new List(nums.Select(n => intFromString(n))); + } + + private int intFromString(string s) + { + try + { + int newNum = int.Parse(s); + updateMinMax(newNum); + _sum += newNum; + return newNum; + } + catch(Exception e) + { + throw new ArgumentException($"Invalid string line passed to NumberLine, {s} can not convert to a number.", e); + } + } + + private void updateMinMax(int num) + { + if (num < Min) + { + Min = num; + } + else if (num > Max) + { + Max = num; + } + } + } +} diff --git a/MissingNumber/MissingNumberTests/MissingNumberTests.csproj b/MissingNumber/MissingNumberTests/MissingNumberTests.csproj index e2ec860..0d0afe5 100644 --- a/MissingNumber/MissingNumberTests/MissingNumberTests.csproj +++ b/MissingNumber/MissingNumberTests/MissingNumberTests.csproj @@ -48,12 +48,18 @@ - + + + + {4a839c5c-a726-4fb4-ab95-d4817d287b99} + MissingNumber + + diff --git a/MissingNumber/MissingNumberTests/NumberLineTests.cs b/MissingNumber/MissingNumberTests/NumberLineTests.cs new file mode 100644 index 0000000..5676cbd --- /dev/null +++ b/MissingNumber/MissingNumberTests/NumberLineTests.cs @@ -0,0 +1,75 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using MissingNumber; +using System.Collections.Generic; +using System.Collections; +using System; + +namespace MissingNumberTests +{ + [TestClass] + public class NumberLineTests + { + [TestMethod] + public void NumberLine_Constructor_ValidDataTest() + { + NumberLine target = new NumberLine("1,2,4,5", ','); + IList expected = new List { 1, 2, 4, 5 }; + CollectionAssert.AreEqual((ICollection)expected, (ICollection)target.Numbers); + } + + [TestMethod] + public void NumberLine_Constructor_WithSpacesTest() + { + NumberLine target = new NumberLine("1, 2 , 4 , 5", ','); + IList expected = new List { 1, 2, 4, 5 }; + CollectionAssert.AreEqual((ICollection)expected, (ICollection)target.Numbers); + } + + [TestMethod] + [ExpectedException(typeof(ArgumentException))] + public void NumberLine_Constructor_InvalidStringTest() + { + NumberLine target = new NumberLine("bad data", ','); + } + + [TestMethod] + public void NumberLine_FindMissingNumber_ValidTest() + { + NumberLine target = new NumberLine("1,2,4,5", ','); + int expected = 3; + Assert.AreEqual(expected, target.FindMissingNumber()); + } + + [TestMethod] + public void NumberLine_FindMissingNumber_ValidTest2() + { + NumberLine target = new NumberLine("1,2,3,4,5,6,7,8,9,10,12", ','); + int expected = 11; + Assert.AreEqual(expected, target.FindMissingNumber()); + } + + [TestMethod] + public void NumberLine_FindMissingNumber_ValidTest3() + { + NumberLine target = new NumberLine("24,26,27,29,28", ','); + int expected = 25; + Assert.AreEqual(expected, target.FindMissingNumber()); + } + + [TestMethod] + public void NumberLine_FindMissingNumber_ValidTest4() + { + NumberLine target = new NumberLine("99,100,101,102,103,104,105,107", ','); + int expected = 106; + Assert.AreEqual(expected, target.FindMissingNumber()); + } + + [TestMethod] + public void NumberLine_FindMissingNumber_ValidTest5() + { + NumberLine target = new NumberLine("109,105,107,108,106,110,112,111,118,116,115,114,117", ','); + int expected = 113; + Assert.AreEqual(expected, target.FindMissingNumber()); + } + } +} diff --git a/MissingNumber/MissingNumberTests/UnitTest1.cs b/MissingNumber/MissingNumberTests/UnitTest1.cs deleted file mode 100644 index ce9436a..0000000 --- a/MissingNumber/MissingNumberTests/UnitTest1.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace MissingNumberTests -{ - [TestClass] - public class UnitTest1 - { - [TestMethod] - public void TestMethod1() - { - } - } -} From 6058b7c85922ea59eafa73f7ca6dfbca8d960712 Mon Sep 17 00:00:00 2001 From: zgp1001 Date: Tue, 23 Jan 2018 18:50:32 -0500 Subject: [PATCH 3/4] File Parser tests added and class made more error proof --- MissingNumber/MissingNumber.sln | 5 ++ MissingNumber/MissingNumber/FileParser.cs | 22 +++++++-- MissingNumber/MissingNumber/NumberLine.cs | 11 +++-- .../DataFiles/badsamples.txt | 3 ++ .../MissingNumberTests/DataFiles/samples.txt | 12 +++++ .../MissingNumberTests/FileParserTests.cs | 47 +++++++++++++++++++ .../MissingNumberTests.csproj | 9 ++++ .../MissingNumberTests/NumberLineTests.cs | 10 ++-- 8 files changed, 105 insertions(+), 14 deletions(-) create mode 100644 MissingNumber/MissingNumberTests/DataFiles/badsamples.txt create mode 100644 MissingNumber/MissingNumberTests/DataFiles/samples.txt create mode 100644 MissingNumber/MissingNumberTests/FileParserTests.cs diff --git a/MissingNumber/MissingNumber.sln b/MissingNumber/MissingNumber.sln index 5c5fc41..18da0d9 100644 --- a/MissingNumber/MissingNumber.sln +++ b/MissingNumber/MissingNumber.sln @@ -7,6 +7,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MissingNumber", "MissingNum EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MissingNumberTests", "MissingNumberTests\MissingNumberTests.csproj", "{21A516FC-C655-481B-9D19-E97615701CD9}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C4A8CA9A-DCBA-445E-97A1-A604F4DB8108}" + ProjectSection(SolutionItems) = preProject + ..\README.md = ..\README.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/MissingNumber/MissingNumber/FileParser.cs b/MissingNumber/MissingNumber/FileParser.cs index e604b21..e0f8f0a 100644 --- a/MissingNumber/MissingNumber/FileParser.cs +++ b/MissingNumber/MissingNumber/FileParser.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; namespace MissingNumber { @@ -14,6 +15,7 @@ public class FileParser /// /// Full path to the file to read /// IList of NumberLine objects created from the file + /// Thrown if the file passed can not be located public IList ParseFile(string filePath) { if (File.Exists(filePath)) @@ -22,23 +24,35 @@ public IList ParseFile(string filePath) } else { - throw new ArgumentException($"Invalid file passed to FileParser, file {filePath} does not exist."); + throw new FileNotFoundException($"Invalid file passed to FileParser, file {filePath} does not exist."); } } private IList parseLines(string [] lines) { List numberLines = new List(); - foreach (string line in lines) + NumberLine tmp; + foreach (string line in lines.Where(l => !string.IsNullOrEmpty(l))) { - numberLines.Add(parseLine(line)); + tmp = parseLine(line); + if (tmp != null) + { + numberLines.Add(tmp); + } } return numberLines; } private NumberLine parseLine(string line) { - return new NumberLine(line, ','); + try + { + return new NumberLine(line, ','); + } + catch (ArgumentException e) + { + return null; + } } } } diff --git a/MissingNumber/MissingNumber/NumberLine.cs b/MissingNumber/MissingNumber/NumberLine.cs index b8ddeb8..906d43b 100644 --- a/MissingNumber/MissingNumber/NumberLine.cs +++ b/MissingNumber/MissingNumber/NumberLine.cs @@ -14,11 +14,13 @@ public class NumberLine /// /// Creats a new NumberLine object /// + /// Thrown if the string given is not of the correct format public NumberLine(string line, char delimiter) { Min = int.MaxValue; Max = int.MinValue; Numbers = populateNumbers(line, delimiter); + MissingNumber = getMissingNumber(); } /// @@ -37,12 +39,11 @@ public NumberLine(string line, char delimiter) public int Max { get; private set; } /// - /// Determines which number is missing from the sequence of Numbers + /// The Number missing from the Number sequence /// - /// - /// - /// - public int FindMissingNumber() + public int MissingNumber { get; private set; } + + private int getMissingNumber() { int expectedSum = (Numbers.Count + 1) * (Min + Max) / 2; return expectedSum - _sum; diff --git a/MissingNumber/MissingNumberTests/DataFiles/badsamples.txt b/MissingNumber/MissingNumberTests/DataFiles/badsamples.txt new file mode 100644 index 0000000..7caede2 --- /dev/null +++ b/MissingNumber/MissingNumberTests/DataFiles/badsamples.txt @@ -0,0 +1,3 @@ +4,3,1,2 +aaaa,see +--,- \ No newline at end of file diff --git a/MissingNumber/MissingNumberTests/DataFiles/samples.txt b/MissingNumber/MissingNumberTests/DataFiles/samples.txt new file mode 100644 index 0000000..04e45e8 --- /dev/null +++ b/MissingNumber/MissingNumberTests/DataFiles/samples.txt @@ -0,0 +1,12 @@ +1,2,3,4,5,6,7,8,9,10,12 + +24,26,27,29,28 + +1,2,4,5 + +99,100,101,102,103,104,105,107 + + + + +109,105,107,108,106,110,112,111,118,116,115,114,117 \ No newline at end of file diff --git a/MissingNumber/MissingNumberTests/FileParserTests.cs b/MissingNumber/MissingNumberTests/FileParserTests.cs new file mode 100644 index 0000000..58dddd6 --- /dev/null +++ b/MissingNumber/MissingNumberTests/FileParserTests.cs @@ -0,0 +1,47 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using MissingNumber; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace MissingNumberTests +{ + [TestClass] + public class FileParserTests + { + [TestMethod] + public void FileParser_ParseFile_ValidTest() + { + FileParser target = new FileParser(); + IList expected = new List { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12 }; + IReadOnlyList actual = target.ParseFile(Path.Combine(Directory.GetCurrentDirectory(), @"DataFiles\samples.txt"))[0].Numbers; + CollectionAssert.AreEqual((ICollection)expected, (ICollection)actual); + } + + [TestMethod] + public void FileParser_ParseFile_IgnoreEmptyLinesTest() + { + FileParser target = new FileParser(); + int expected = 5; + int actual = target.ParseFile(Path.Combine(Directory.GetCurrentDirectory(), @"DataFiles\samples.txt")).Count; + Assert.AreEqual(expected, actual); + } + + [TestMethod] + public void FileParser_ParseFile_BadDataTest() + { + FileParser target = new FileParser(); + int expected = 1; + int actual = target.ParseFile(Path.Combine(Directory.GetCurrentDirectory(), @"DataFiles\badsamples.txt")).Count; + Assert.AreEqual(expected, actual); + } + + [TestMethod] + [ExpectedException(typeof(FileNotFoundException))] + public void FileParser_ParseFile_FileNotFoundTest() + { + FileParser target = new FileParser(); + target.ParseFile("fileThatDoesntExist.txt"); + } + } +} diff --git a/MissingNumber/MissingNumberTests/MissingNumberTests.csproj b/MissingNumber/MissingNumberTests/MissingNumberTests.csproj index 0d0afe5..8c1d78e 100644 --- a/MissingNumber/MissingNumberTests/MissingNumberTests.csproj +++ b/MissingNumber/MissingNumberTests/MissingNumberTests.csproj @@ -48,6 +48,7 @@ + @@ -60,6 +61,14 @@ MissingNumber + + + Always + + + Always + + diff --git a/MissingNumber/MissingNumberTests/NumberLineTests.cs b/MissingNumber/MissingNumberTests/NumberLineTests.cs index 5676cbd..dd60578 100644 --- a/MissingNumber/MissingNumberTests/NumberLineTests.cs +++ b/MissingNumber/MissingNumberTests/NumberLineTests.cs @@ -37,7 +37,7 @@ public void NumberLine_FindMissingNumber_ValidTest() { NumberLine target = new NumberLine("1,2,4,5", ','); int expected = 3; - Assert.AreEqual(expected, target.FindMissingNumber()); + Assert.AreEqual(expected, target.MissingNumber); } [TestMethod] @@ -45,7 +45,7 @@ public void NumberLine_FindMissingNumber_ValidTest2() { NumberLine target = new NumberLine("1,2,3,4,5,6,7,8,9,10,12", ','); int expected = 11; - Assert.AreEqual(expected, target.FindMissingNumber()); + Assert.AreEqual(expected, target.MissingNumber); } [TestMethod] @@ -53,7 +53,7 @@ public void NumberLine_FindMissingNumber_ValidTest3() { NumberLine target = new NumberLine("24,26,27,29,28", ','); int expected = 25; - Assert.AreEqual(expected, target.FindMissingNumber()); + Assert.AreEqual(expected, target.MissingNumber); } [TestMethod] @@ -61,7 +61,7 @@ public void NumberLine_FindMissingNumber_ValidTest4() { NumberLine target = new NumberLine("99,100,101,102,103,104,105,107", ','); int expected = 106; - Assert.AreEqual(expected, target.FindMissingNumber()); + Assert.AreEqual(expected, target.MissingNumber); } [TestMethod] @@ -69,7 +69,7 @@ public void NumberLine_FindMissingNumber_ValidTest5() { NumberLine target = new NumberLine("109,105,107,108,106,110,112,111,118,116,115,114,117", ','); int expected = 113; - Assert.AreEqual(expected, target.FindMissingNumber()); + Assert.AreEqual(expected, target.MissingNumber); } } } From 43ae0693bdc031988df966935e63df75dce714a8 Mon Sep 17 00:00:00 2001 From: zgp1001 Date: Tue, 23 Jan 2018 21:04:57 -0500 Subject: [PATCH 4/4] Fixed small issue with tracking min/max --- MissingNumber/MissingNumber/MainViewModel.cs | 32 ++++++++++++++++ MissingNumber/MissingNumber/MainWindow.xaml | 10 +++-- .../MissingNumber/MainWindow.xaml.cs | 30 ++++++++------- .../MissingNumber/MissingNumber.csproj | 1 + MissingNumber/MissingNumber/NumberLine.cs | 2 +- .../DataFiles/badsamples.txt | 2 +- .../MissingNumberTests/DataFiles/blank.txt | 1 + .../MissingNumberTests/DataFiles/novalid.txt | 3 ++ .../DataFiles/wrongformat.pdf | Bin 0 -> 246779 bytes .../MissingNumberTests/FileParserTests.cs | 28 ++++++++++++++ .../MissingNumberTests/MainViewModelTests.cs | 36 ++++++++++++++++++ .../MissingNumberTests.csproj | 10 +++++ 12 files changed, 136 insertions(+), 19 deletions(-) create mode 100644 MissingNumber/MissingNumber/MainViewModel.cs create mode 100644 MissingNumber/MissingNumberTests/DataFiles/blank.txt create mode 100644 MissingNumber/MissingNumberTests/DataFiles/novalid.txt create mode 100644 MissingNumber/MissingNumberTests/DataFiles/wrongformat.pdf create mode 100644 MissingNumber/MissingNumberTests/MainViewModelTests.cs diff --git a/MissingNumber/MissingNumber/MainViewModel.cs b/MissingNumber/MissingNumber/MainViewModel.cs new file mode 100644 index 0000000..e0b2ed4 --- /dev/null +++ b/MissingNumber/MissingNumber/MainViewModel.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace MissingNumber +{ + /// + /// Simple ViewModel to control basic flow of application, not really a true view model but similiar in responsibility + /// + public class MainViewModel + { + private FileParser _parser = new FileParser(); + + /// + /// Results that correspond to the input. These are the missing Numbers + /// + public ObservableCollection Results { get; private set; } = new ObservableCollection(); + + /// + /// Takes a file from the user and finds all the missing numbers + /// + /// Location of the file to use + public void ReadFile(string fileLocation) + { + Results.Clear(); + IList numLines = _parser.ParseFile(fileLocation); + foreach (NumberLine numLine in numLines) + { + Results.Add(numLine.MissingNumber); + } + } + } +} diff --git a/MissingNumber/MissingNumber/MainWindow.xaml b/MissingNumber/MissingNumber/MainWindow.xaml index f8a0d4e..56e1c4a 100644 --- a/MissingNumber/MissingNumber/MainWindow.xaml +++ b/MissingNumber/MissingNumber/MainWindow.xaml @@ -5,8 +5,10 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:MissingNumber" mc:Ignorable="d" - Title="MainWindow" Height="350" Width="525"> - - - + Title="Missing Number" Height="700" Width="700"> + +