├── .gitignore ├── AcmeApp-For VS2013 ├── Acme.Biz │ ├── Acme.Biz.csproj │ ├── Product.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Vendor.cs │ └── VendorRepository.cs ├── Acme.Common │ ├── Acme.Common.csproj │ ├── EmailService.cs │ ├── LoggingService.cs │ ├── OperationResult.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Acme.Win │ ├── Acme.Win.csproj │ ├── App.config │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── VendorWin.Designer.cs │ ├── VendorWin.cs │ └── VendorWin.resx ├── Acme.Wpf │ ├── Acme.Wpf.csproj │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ │ └── StyleLibrary.xaml │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ViewModels │ │ └── VendorDetailViewModel.cs │ └── Views │ │ ├── VendorDetailView.xaml │ │ └── VendorDetailView.xaml.cs ├── AcmeApp.sln └── Tests │ ├── Acme.BizTests │ ├── Acme.BizTests.csproj │ ├── ProductTests.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── VendorRepositoryTests.cs │ └── VendorTests.cs │ └── Acme.CommonTests │ ├── Acme.CommonTests.csproj │ ├── EmailServiceTests.cs │ ├── LoggingServiceTests.cs │ └── Properties │ └── AssemblyInfo.cs ├── AcmeApp ├── Acme.Biz │ ├── Acme.Biz.csproj │ ├── Product.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Vendor.cs │ └── VendorRepository.cs ├── Acme.Common │ ├── Acme.Common.csproj │ ├── EmailService.cs │ ├── LoggingService.cs │ ├── OperationResult.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Acme.Win │ ├── Acme.Win.csproj │ ├── App.config │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── VendorWin.Designer.cs │ ├── VendorWin.cs │ └── VendorWin.resx ├── Acme.Wpf │ ├── Acme.Wpf.csproj │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ │ └── StyleLibrary.xaml │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ViewModels │ │ └── VendorDetailViewModel.cs │ └── Views │ │ ├── VendorDetailView.xaml │ │ └── VendorDetailView.xaml.cs ├── AcmeApp.sln └── Tests │ ├── Acme.BizTests │ ├── Acme.BizTests.csproj │ ├── ProductTests.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── VendorRepositoryTests.cs │ └── VendorTests.cs │ └── Acme.CommonTests │ ├── Acme.CommonTests.csproj │ ├── EmailServiceTests.cs │ ├── LoggingServiceTests.cs │ └── Properties │ └── AssemblyInfo.cs ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | bower_components/ 165 | 166 | # RIA/Silverlight projects 167 | Generated_Code/ 168 | 169 | # Backup & report files from converting an old project file 170 | # to a newer Visual Studio version. Backup files are not needed, 171 | # because we have git ;-) 172 | _UpgradeReport_Files/ 173 | Backup*/ 174 | UpgradeLog*.XML 175 | UpgradeLog*.htm 176 | 177 | # SQL Server files 178 | *.mdf 179 | *.ldf 180 | 181 | # Business Intelligence projects 182 | *.rdl.data 183 | *.bim.layout 184 | *.bim_*.settings 185 | 186 | # Microsoft Fakes 187 | FakesAssemblies/ 188 | 189 | # Node.js Tools for Visual Studio 190 | .ntvs_analysis.dat 191 | 192 | # Visual Studio 6 build log 193 | *.plg 194 | 195 | # Visual Studio 6 workspace options file 196 | *.opt 197 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Biz/Acme.Biz.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {5C818AB4-0B33-4802-933D-11210EB5C229} 8 | Library 9 | Properties 10 | Acme.Biz 11 | Acme.Biz 12 | v4.6 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | {931b808f-2620-4b71-9f23-680f3ba90e6b} 51 | Acme.Common 52 | 53 | 54 | 55 | 62 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Biz/Product.cs: -------------------------------------------------------------------------------- 1 | using Acme.Common; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Acme.Biz 9 | { 10 | /// 11 | /// Manages products carried in inventory. 12 | /// 13 | public class Product 14 | { 15 | #region Constructors 16 | public Product() 17 | { 18 | } 19 | public Product(int productId, 20 | string productName, 21 | string description) : this() 22 | { 23 | this.ProductId = productId; 24 | this.ProductName = productName; 25 | this.Description = description; 26 | } 27 | #endregion 28 | 29 | #region Properties 30 | public DateTime? AvailabilityDate { get; set; } 31 | 32 | public decimal Cost { get; set; } 33 | 34 | public string Description { get; set; } 35 | 36 | public int ProductId { get; set; } 37 | 38 | private string productName; 39 | public string ProductName 40 | { 41 | get { 42 | var formattedValue= string.IsNullOrWhiteSpace(productName) ? null: productName.Trim(); 43 | return formattedValue; 44 | } 45 | set 46 | { 47 | if (value.Length < 3) 48 | { 49 | ValidationMessage = "Product Name must be at least 3 characters"; 50 | } 51 | else if (value.Length > 20) 52 | { 53 | ValidationMessage = "Product Name cannot be more than 20 characters"; 54 | 55 | } 56 | else 57 | { 58 | productName = value; 59 | 60 | } 61 | } 62 | } 63 | 64 | private Vendor productVendor; 65 | public Vendor ProductVendor 66 | { 67 | get { 68 | if (productVendor == null) 69 | { 70 | productVendor = new Vendor(); 71 | } 72 | return productVendor; 73 | } 74 | set { productVendor = value; } 75 | } 76 | 77 | public string ValidationMessage { get; private set; } 78 | 79 | #endregion 80 | 81 | /// 82 | /// Calculates the suggested retail price 83 | /// 84 | /// Percent used to mark up the cost. 85 | /// 86 | public decimal CalculateSuggestedPrice(decimal markupPercent) { 87 | return this.Cost + (this.Cost * markupPercent / 100); 88 | } 89 | 90 | public override string ToString() 91 | { 92 | return this.ProductName + " (" + this.ProductId + ")"; 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Biz/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Acme.Biz")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 12 | [assembly: AssemblyProduct("Acme.Biz")] 13 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | [assembly: InternalsVisibleTo("Acme.BizTests")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("5c818ab4-0b33-4802-933d-11210eb5c229")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("1.0.0.0")] 37 | [assembly: AssemblyFileVersion("1.0.0.0")] 38 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Biz/Vendor.cs: -------------------------------------------------------------------------------- 1 | using Acme.Common; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Acme.Biz 9 | { 10 | /// 11 | /// Manages the approved vendors from whom Acme purchases our inventory. 12 | /// 13 | public class Vendor 14 | { 15 | public int VendorId { get; set; } 16 | public string CompanyName { get; set; } 17 | public string Email { get; set; } 18 | 19 | /// 20 | /// Sends a product order to the vendor. 21 | /// 22 | /// Product to order. 23 | /// Quantity of the product to order. 24 | /// Requested delivery date. 25 | /// Delivery instructions. 26 | /// 27 | public OperationResult PlaceOrder(Product product, int quantity, 28 | DateTimeOffset? deliverBy = null, 29 | string instructions = "standard delivery") 30 | { 31 | if (product == null) 32 | throw new ArgumentNullException("product"); 33 | if (quantity <= 0) 34 | throw new ArgumentOutOfRangeException("quantity"); 35 | if (deliverBy <= DateTimeOffset.Now) 36 | throw new ArgumentOutOfRangeException("deliverBy"); 37 | 38 | var success = false; 39 | 40 | var orderTextBuilder = new StringBuilder("Order from Acme, Inc" + 41 | System.Environment.NewLine + 42 | "Product: " + product.ProductName + 43 | System.Environment.NewLine + 44 | "Quantity: " + quantity); 45 | if (deliverBy.HasValue) 46 | { 47 | orderTextBuilder.Append( System.Environment.NewLine + 48 | "Deliver By: " + deliverBy.Value.ToString("d")); 49 | } 50 | if (!String.IsNullOrWhiteSpace(instructions)) 51 | { 52 | orderTextBuilder.Append( System.Environment.NewLine + 53 | "Instructions: " + instructions); 54 | } 55 | var orderText = orderTextBuilder.ToString(); 56 | 57 | var emailService = new EmailService(); 58 | var confirmation = emailService.SendMessage("New Order", orderText, 59 | this.Email); 60 | if (confirmation.StartsWith("Message sent:")) 61 | { 62 | success = true; 63 | } 64 | var operationResult = new OperationResult(success, orderText); 65 | return operationResult; 66 | } 67 | 68 | public override string ToString() 69 | { 70 | return string.Format("Vendor: {0} ({1})", 71 | this.CompanyName, 72 | this.VendorId); 73 | } 74 | 75 | 76 | /// 77 | /// Sends an email to welcome a new vendor. 78 | /// 79 | /// 80 | public string SendWelcomeEmail(string message) 81 | { 82 | var emailService = new EmailService(); 83 | var subject = ("Hello " + this.CompanyName).Trim(); 84 | var confirmation = emailService.SendMessage(subject, 85 | message, 86 | this.Email); 87 | return confirmation; 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Biz/VendorRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Acme.Biz 8 | { 9 | public class VendorRepository 10 | { 11 | /// 12 | /// Retrieve one vendor. 13 | /// 14 | /// Id of the vendor to retrieve. 15 | public Vendor Retrieve(int vendorId) 16 | { 17 | // Create the instance of the Vendor class 18 | Vendor vendor = new Vendor(); 19 | 20 | // Code that retrieves the defined customer 21 | 22 | // Temporary hard coded values to return 23 | if (vendorId == 1) 24 | { 25 | vendor.VendorId = 1; 26 | vendor.CompanyName = "ABC Corp"; 27 | vendor.Email = "abc@abc.com"; 28 | } 29 | return vendor; 30 | } 31 | 32 | /// 33 | /// Save data for one vendor. 34 | /// 35 | /// Instance of the vendor to save. 36 | /// 37 | public bool Save(Vendor vendor) 38 | { 39 | var success = true; 40 | 41 | // Code that saves the vendor 42 | 43 | return success; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Common/Acme.Common.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {931B808F-2620-4B71-9F23-680F3BA90E6B} 8 | Library 9 | Properties 10 | Acme.Common 11 | Acme.Common 12 | v4.6 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Common/EmailService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Acme.Common 8 | { 9 | /// 10 | /// Provides services to send email. 11 | /// 12 | public class EmailService 13 | { 14 | /// 15 | /// Sends email message 16 | /// 17 | /// Subject of the message. 18 | /// Message text 19 | /// Email address of the message recipient. 20 | /// 21 | public string SendMessage(string subject, string message, 22 | string recipient) 23 | { 24 | // Code to send an email 25 | 26 | var confirmation = "Message sent: " + subject; 27 | LoggingService.LogAction(confirmation); 28 | return confirmation; 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Common/LoggingService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Acme.Common 8 | { 9 | /// 10 | /// Provides logging. 11 | /// 12 | public static class LoggingService 13 | { 14 | /// 15 | /// Logs actions. 16 | /// 17 | /// Action to log. 18 | public static string LogAction(string action) 19 | { 20 | var logText = "Action: " + action; 21 | Console.WriteLine(logText); 22 | 23 | return logText; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Common/OperationResult.cs: -------------------------------------------------------------------------------- 1 | namespace Acme.Common 2 | { 3 | /// 4 | /// Provides a success flag and message 5 | /// useful as a method return type. 6 | /// 7 | public class OperationResult 8 | { 9 | public OperationResult() 10 | { 11 | } 12 | 13 | public OperationResult(bool success, string message) : this() 14 | { 15 | this.Success = success; 16 | this.Message = message; 17 | } 18 | 19 | public bool Success { get; set; } 20 | public string Message { get; set; } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Acme.Common")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 12 | [assembly: AssemblyProduct("Acme.Common")] 13 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("931b808f-2620-4b71-9f23-680f3ba90e6b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Win/Acme.Win.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A22E0D0A-25D7-428F-978C-364C2A4CAE81} 8 | WinExe 9 | Properties 10 | Acme.Win 11 | Acme.Win 12 | v4.6 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Form 51 | 52 | 53 | VendorWin.cs 54 | 55 | 56 | 57 | 58 | ResXFileCodeGenerator 59 | Resources.Designer.cs 60 | Designer 61 | 62 | 63 | True 64 | Resources.resx 65 | 66 | 67 | VendorWin.cs 68 | 69 | 70 | SettingsSingleFileGenerator 71 | Settings.Designer.cs 72 | 73 | 74 | True 75 | Settings.settings 76 | True 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | {5c818ab4-0b33-4802-933d-11210eb5c229} 85 | Acme.Biz 86 | 87 | 88 | 89 | 96 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Win/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Win/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace Acme.Win 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new VendorWin()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Win/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Acme.Win")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 12 | [assembly: AssemblyProduct("Acme.Win")] 13 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a22e0d0a-25d7-428f-978c-364c2a4cae81")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Win/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Acme.Win.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Acme.Win.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Win/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Win/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Acme.Win.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Win/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Win/VendorWin.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Acme.Win 2 | { 3 | partial class VendorWin 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.label1 = new System.Windows.Forms.Label(); 32 | this.CompanyNameTextBox = new System.Windows.Forms.TextBox(); 33 | this.EmailTextBox = new System.Windows.Forms.TextBox(); 34 | this.label2 = new System.Windows.Forms.Label(); 35 | this.CancelChangesButton = new System.Windows.Forms.Button(); 36 | this.SaveButton = new System.Windows.Forms.Button(); 37 | this.SuspendLayout(); 38 | // 39 | // label1 40 | // 41 | this.label1.AutoSize = true; 42 | this.label1.Location = new System.Drawing.Point(13, 13); 43 | this.label1.Name = "label1"; 44 | this.label1.Size = new System.Drawing.Size(82, 13); 45 | this.label1.TabIndex = 0; 46 | this.label1.Text = "Company Name"; 47 | // 48 | // CompanyNameTextBox 49 | // 50 | this.CompanyNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 51 | | System.Windows.Forms.AnchorStyles.Right))); 52 | this.CompanyNameTextBox.Location = new System.Drawing.Point(13, 30); 53 | this.CompanyNameTextBox.Name = "CompanyNameTextBox"; 54 | this.CompanyNameTextBox.Size = new System.Drawing.Size(275, 20); 55 | this.CompanyNameTextBox.TabIndex = 1; 56 | // 57 | // EmailTextBox 58 | // 59 | this.EmailTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 60 | | System.Windows.Forms.AnchorStyles.Right))); 61 | this.EmailTextBox.Location = new System.Drawing.Point(16, 71); 62 | this.EmailTextBox.Name = "EmailTextBox"; 63 | this.EmailTextBox.Size = new System.Drawing.Size(275, 20); 64 | this.EmailTextBox.TabIndex = 3; 65 | // 66 | // label2 67 | // 68 | this.label2.AutoSize = true; 69 | this.label2.Location = new System.Drawing.Point(16, 54); 70 | this.label2.Name = "label2"; 71 | this.label2.Size = new System.Drawing.Size(76, 13); 72 | this.label2.TabIndex = 2; 73 | this.label2.Text = "Email Address:"; 74 | // 75 | // CancelChangesButton 76 | // 77 | this.CancelChangesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 78 | this.CancelChangesButton.CausesValidation = false; 79 | this.CancelChangesButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 80 | this.CancelChangesButton.Location = new System.Drawing.Point(214, 143); 81 | this.CancelChangesButton.Name = "CancelChangesButton"; 82 | this.CancelChangesButton.Size = new System.Drawing.Size(75, 23); 83 | this.CancelChangesButton.TabIndex = 4; 84 | this.CancelChangesButton.Text = "Cancel"; 85 | this.CancelChangesButton.UseVisualStyleBackColor = true; 86 | this.CancelChangesButton.Click += new System.EventHandler(this.CancelChangesButton_Click); 87 | // 88 | // SaveButton 89 | // 90 | this.SaveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 91 | this.SaveButton.DialogResult = System.Windows.Forms.DialogResult.OK; 92 | this.SaveButton.Location = new System.Drawing.Point(133, 143); 93 | this.SaveButton.Name = "SaveButton"; 94 | this.SaveButton.Size = new System.Drawing.Size(75, 23); 95 | this.SaveButton.TabIndex = 5; 96 | this.SaveButton.Text = "Save"; 97 | this.SaveButton.UseVisualStyleBackColor = true; 98 | this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click); 99 | // 100 | // VendorWin 101 | // 102 | this.AcceptButton = this.SaveButton; 103 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 104 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 105 | this.ClientSize = new System.Drawing.Size(301, 178); 106 | this.Controls.Add(this.SaveButton); 107 | this.Controls.Add(this.CancelChangesButton); 108 | this.Controls.Add(this.EmailTextBox); 109 | this.Controls.Add(this.label2); 110 | this.Controls.Add(this.CompanyNameTextBox); 111 | this.Controls.Add(this.label1); 112 | this.MinimumSize = new System.Drawing.Size(301, 187); 113 | this.Name = "VendorWin"; 114 | this.Text = "Vendor Detail"; 115 | this.Load += new System.EventHandler(this.Vendor_Load); 116 | this.ResumeLayout(false); 117 | this.PerformLayout(); 118 | 119 | } 120 | 121 | #endregion 122 | 123 | private System.Windows.Forms.Label label1; 124 | private System.Windows.Forms.TextBox CompanyNameTextBox; 125 | private System.Windows.Forms.TextBox EmailTextBox; 126 | private System.Windows.Forms.Label label2; 127 | private System.Windows.Forms.Button CancelChangesButton; 128 | private System.Windows.Forms.Button SaveButton; 129 | } 130 | } 131 | 132 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Win/VendorWin.cs: -------------------------------------------------------------------------------- 1 | using Acme.Biz; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace Acme.Win 13 | { 14 | public partial class VendorWin : Form 15 | { 16 | Vendor currentVendor; 17 | VendorRepository vendorRepository; 18 | 19 | public VendorWin() 20 | { 21 | InitializeComponent(); 22 | } 23 | 24 | private void Vendor_Load(object sender, EventArgs e) 25 | { 26 | LoadData(); 27 | } 28 | 29 | private void SaveButton_Click(object sender, EventArgs e) 30 | { 31 | // Update the properties 32 | currentVendor.CompanyName = this.CompanyNameTextBox.Text; 33 | currentVendor.Email = this.EmailTextBox.Text; 34 | vendorRepository.Save(currentVendor); 35 | } 36 | 37 | private void CancelChangesButton_Click(object sender, EventArgs e) 38 | { 39 | LoadData(); 40 | } 41 | 42 | private void LoadData() 43 | { 44 | vendorRepository = new VendorRepository(); 45 | currentVendor = vendorRepository.Retrieve(1); 46 | 47 | // Populate the form 48 | this.CompanyNameTextBox.Text = currentVendor.CompanyName; 49 | this.EmailTextBox.Text = currentVendor.Email; 50 | } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Win/VendorWin.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/Acme.Wpf.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {42D49B3A-5F7B-4242-BC5C-66075496C895} 8 | WinExe 9 | Properties 10 | Acme.Wpf 11 | Acme.Wpf 12 | v4.6 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | true 17 | 18 | 19 | AnyCPU 20 | true 21 | full 22 | false 23 | bin\Debug\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | AnyCPU 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 4.0 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | MSBuild:Compile 56 | Designer 57 | 58 | 59 | 60 | VendorDetailView.xaml 61 | 62 | 63 | Designer 64 | MSBuild:Compile 65 | 66 | 67 | MSBuild:Compile 68 | Designer 69 | 70 | 71 | App.xaml 72 | Code 73 | 74 | 75 | MainWindow.xaml 76 | Code 77 | 78 | 79 | Designer 80 | MSBuild:Compile 81 | 82 | 83 | 84 | 85 | Code 86 | 87 | 88 | True 89 | True 90 | Resources.resx 91 | 92 | 93 | True 94 | Settings.settings 95 | True 96 | 97 | 98 | ResXFileCodeGenerator 99 | Resources.Designer.cs 100 | 101 | 102 | SettingsSingleFileGenerator 103 | Settings.Designer.cs 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | {5c818ab4-0b33-4802-933d-11210eb5c229} 114 | Acme.Biz 115 | 116 | 117 | 118 | 125 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace Acme.Wpf 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/Assets/StyleLibrary.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | Verdana 6 | 7 | Orange 9 | White 11 | Gray 13 | Black 15 | 16 | 19 | 22 | 25 | 26 | 28 | 29 | 32 | 35 | 36 | 37 | 38 | 54 | 55 | 68 | 69 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  8 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Acme.Wpf 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow : NavigationWindow 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("Acme.Wpf")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 14 | [assembly: AssemblyProduct("Acme.Wpf")] 15 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Acme.Wpf.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Acme.Wpf.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Acme.Wpf.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/ViewModels/VendorDetailViewModel.cs: -------------------------------------------------------------------------------- 1 | using Acme.Biz; 2 | 3 | namespace Acme.Wpf.ViewModels 4 | { 5 | public class VendorDetailViewModel 6 | { 7 | public Vendor currentVendor { get; set; } 8 | 9 | VendorRepository vendorRepository = new VendorRepository(); 10 | 11 | public VendorDetailViewModel() 12 | { 13 | LoadData(); 14 | } 15 | 16 | public void LoadData() 17 | { 18 | currentVendor = vendorRepository.Retrieve(1); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/Views/VendorDetailView.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 33 | 34 | 35 | 38 | 39 | 42 | 43 | 44 | 45 | 46 | 48 | 49 | 51 | 52 | 54 | 55 | 56 | 57 | 58 | 60 | 61 | 63 | 64 | 66 | 67 | 68 | 76 | 80 | 81 | 82 | 90 | 94 | 95 | 96 | 97 | 102 | 106 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Acme.Wpf/Views/VendorDetailView.xaml.cs: -------------------------------------------------------------------------------- 1 | using Acme.Biz; 2 | using Acme.Wpf.ViewModels; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | 6 | namespace Acme.Wpf.Views 7 | { 8 | /// 9 | /// Interaction logic for VendorDetailView.xaml 10 | /// 11 | public partial class VendorDetailView : Page 12 | { 13 | public VendorDetailView() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | private void SaveButton_Click(object sender, RoutedEventArgs e) 19 | { 20 | var vm = (VendorDetailViewModel)((Button)e.OriginalSource).DataContext; 21 | if (vm != null) 22 | { 23 | var vendorRepository = new VendorRepository(); 24 | vendorRepository.Save(vm.currentVendor); 25 | } 26 | } 27 | 28 | private void CancelButton_Click(object sender, RoutedEventArgs e) 29 | { 30 | this.NavigationService.Refresh(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/AcmeApp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{551F9D44-8CC5-49B7-9EFD-4CC57CFDB504}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.Common", "Acme.Common\Acme.Common.csproj", "{931B808F-2620-4B71-9F23-680F3BA90E6B}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.CommonTests", "Tests\Acme.CommonTests\Acme.CommonTests.csproj", "{811EE95C-ED43-4601-BFAB-E75B41FD263A}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.Biz", "Acme.Biz\Acme.Biz.csproj", "{5C818AB4-0B33-4802-933D-11210EB5C229}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.BizTests", "Tests\Acme.BizTests\Acme.BizTests.csproj", "{8A097724-9C89-4645-9629-E9FA945E8695}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.Win", "Acme.Win\Acme.Win.csproj", "{A22E0D0A-25D7-428F-978C-364C2A4CAE81}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.Wpf", "Acme.Wpf\Acme.Wpf.csproj", "{42D49B3A-5F7B-4242-BC5C-66075496C895}" 19 | EndProject 20 | Global 21 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 22 | Debug|Any CPU = Debug|Any CPU 23 | Release|Any CPU = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 26 | {931B808F-2620-4B71-9F23-680F3BA90E6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {931B808F-2620-4B71-9F23-680F3BA90E6B}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {931B808F-2620-4B71-9F23-680F3BA90E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {931B808F-2620-4B71-9F23-680F3BA90E6B}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {811EE95C-ED43-4601-BFAB-E75B41FD263A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {811EE95C-ED43-4601-BFAB-E75B41FD263A}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {811EE95C-ED43-4601-BFAB-E75B41FD263A}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {811EE95C-ED43-4601-BFAB-E75B41FD263A}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {5C818AB4-0B33-4802-933D-11210EB5C229}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {5C818AB4-0B33-4802-933D-11210EB5C229}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {5C818AB4-0B33-4802-933D-11210EB5C229}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {5C818AB4-0B33-4802-933D-11210EB5C229}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {8A097724-9C89-4645-9629-E9FA945E8695}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {8A097724-9C89-4645-9629-E9FA945E8695}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {8A097724-9C89-4645-9629-E9FA945E8695}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {8A097724-9C89-4645-9629-E9FA945E8695}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {A22E0D0A-25D7-428F-978C-364C2A4CAE81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 43 | {A22E0D0A-25D7-428F-978C-364C2A4CAE81}.Debug|Any CPU.Build.0 = Debug|Any CPU 44 | {A22E0D0A-25D7-428F-978C-364C2A4CAE81}.Release|Any CPU.ActiveCfg = Release|Any CPU 45 | {A22E0D0A-25D7-428F-978C-364C2A4CAE81}.Release|Any CPU.Build.0 = Release|Any CPU 46 | {42D49B3A-5F7B-4242-BC5C-66075496C895}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 47 | {42D49B3A-5F7B-4242-BC5C-66075496C895}.Debug|Any CPU.Build.0 = Debug|Any CPU 48 | {42D49B3A-5F7B-4242-BC5C-66075496C895}.Release|Any CPU.ActiveCfg = Release|Any CPU 49 | {42D49B3A-5F7B-4242-BC5C-66075496C895}.Release|Any CPU.Build.0 = Release|Any CPU 50 | EndGlobalSection 51 | GlobalSection(SolutionProperties) = preSolution 52 | HideSolutionNode = FALSE 53 | EndGlobalSection 54 | GlobalSection(NestedProjects) = preSolution 55 | {811EE95C-ED43-4601-BFAB-E75B41FD263A} = {551F9D44-8CC5-49B7-9EFD-4CC57CFDB504} 56 | {8A097724-9C89-4645-9629-E9FA945E8695} = {551F9D44-8CC5-49B7-9EFD-4CC57CFDB504} 57 | EndGlobalSection 58 | EndGlobal 59 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Tests/Acme.BizTests/Acme.BizTests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {8A097724-9C89-4645-9629-E9FA945E8695} 7 | Library 8 | Properties 9 | Acme.BizTests 10 | Acme.BizTests 11 | v4.6 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | {5c818ab4-0b33-4802-933d-11210eb5c229} 62 | Acme.Biz 63 | 64 | 65 | {931b808f-2620-4b71-9f23-680f3ba90e6b} 66 | Acme.Common 67 | 68 | 69 | 70 | 71 | 72 | 73 | False 74 | 75 | 76 | False 77 | 78 | 79 | False 80 | 81 | 82 | False 83 | 84 | 85 | 86 | 87 | 88 | 89 | 96 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Tests/Acme.BizTests/ProductTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Acme.Biz; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Acme.Common; 9 | 10 | namespace Acme.Biz.Tests 11 | { 12 | [TestClass()] 13 | public class ProductTests 14 | { 15 | 16 | [TestMethod()] 17 | public void CalculateSuggestedPriceTest() 18 | { 19 | // Arrange 20 | var currentProduct = new Product(1, "Saw", ""); 21 | currentProduct.Cost = 50m; 22 | var expected = 55m; 23 | 24 | // Act 25 | var actual = currentProduct.CalculateSuggestedPrice(10m); 26 | 27 | // Assert 28 | Assert.AreEqual(expected, actual); 29 | } 30 | 31 | [TestMethod()] 32 | public void Product_Null() 33 | { 34 | //Arrange 35 | Product currentProduct = null; 36 | string companyName = null; 37 | if (currentProduct != null && currentProduct.ProductVendor != null) { 38 | companyName = currentProduct.ProductVendor.CompanyName; 39 | } 40 | 41 | string expected = null; 42 | 43 | //Act 44 | var actual = companyName; 45 | 46 | //Assert 47 | Assert.AreEqual(expected, actual); 48 | } 49 | 50 | [TestMethod()] 51 | public void ProductName_Format() 52 | { 53 | //Arrange 54 | var currentProduct = new Product(); 55 | currentProduct.ProductName = " Steel Hammer "; 56 | 57 | var expected = "Steel Hammer"; 58 | 59 | //Act 60 | var actual = currentProduct.ProductName; 61 | 62 | //Assert 63 | Assert.AreEqual(expected, actual); 64 | } 65 | 66 | [TestMethod()] 67 | public void ProductName_TooShort() 68 | { 69 | //Arrange 70 | var currentProduct = new Product(); 71 | currentProduct.ProductName = "aw"; 72 | 73 | string expected = null; 74 | string expectedMessage = "Product Name must be at least 3 characters"; 75 | 76 | //Act 77 | var actual = currentProduct.ProductName; 78 | var actualMessage = currentProduct.ValidationMessage; 79 | 80 | //Assert 81 | Assert.AreEqual(expected, actual); 82 | Assert.AreEqual(expectedMessage, actualMessage); 83 | } 84 | 85 | [TestMethod()] 86 | public void ProductName_TooLong() 87 | { 88 | //Arrange 89 | var currentProduct = new Product(); 90 | currentProduct.ProductName = "Steel Bladed Hand Saw"; 91 | 92 | string expected = null; 93 | string expectedMessage = "Product Name cannot be more than 20 characters"; 94 | 95 | //Act 96 | var actual = currentProduct.ProductName; 97 | var actualMessage = currentProduct.ValidationMessage; 98 | 99 | //Assert 100 | Assert.AreEqual(expected, actual); 101 | Assert.AreEqual(expectedMessage, actualMessage); 102 | } 103 | 104 | [TestMethod()] 105 | public void ProductName_JustRight() 106 | { 107 | //Arrange 108 | var currentProduct = new Product(); 109 | currentProduct.ProductName = "Saw"; 110 | 111 | string expected = "Saw"; 112 | string expectedMessage = null; 113 | 114 | //Act 115 | var actual = currentProduct.ProductName; 116 | var actualMessage = currentProduct.ValidationMessage; 117 | 118 | //Assert 119 | Assert.AreEqual(expected, actual); 120 | Assert.AreEqual(expectedMessage, actualMessage); 121 | } 122 | 123 | } 124 | } -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Tests/Acme.BizTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Acme.BizTests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 12 | [assembly: AssemblyProduct("Acme.BizTests")] 13 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8a097724-9c89-4645-9629-e9fa945e8695")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Tests/Acme.BizTests/VendorRepositoryTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Acme.Biz; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Acme.Biz.Tests 10 | { 11 | [TestClass()] 12 | public class VendorRepositoryTests 13 | { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Tests/Acme.BizTests/VendorTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Acme.Biz; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Acme.Common; 9 | 10 | namespace Acme.Biz.Tests 11 | { 12 | [TestClass()] 13 | public class VendorTests 14 | { 15 | [TestMethod()] 16 | public void SendWelcomeEmail_ValidCompany_Success() 17 | { 18 | // Arrange 19 | var vendor = new Vendor(); 20 | vendor.CompanyName = "ABC Corp"; 21 | var expected = "Message sent: Hello ABC Corp"; 22 | 23 | // Act 24 | var actual = vendor.SendWelcomeEmail("Test Message"); 25 | 26 | // Assert 27 | Assert.AreEqual(expected, actual); 28 | } 29 | 30 | [TestMethod()] 31 | public void SendWelcomeEmail_EmptyCompany_Success() 32 | { 33 | // Arrange 34 | var vendor = new Vendor(); 35 | vendor.CompanyName = ""; 36 | var expected = "Message sent: Hello"; 37 | 38 | // Act 39 | var actual = vendor.SendWelcomeEmail("Test Message"); 40 | 41 | // Assert 42 | Assert.AreEqual(expected, actual); 43 | } 44 | 45 | [TestMethod()] 46 | public void SendWelcomeEmail_NullCompany_Success() 47 | { 48 | // Arrange 49 | var vendor = new Vendor(); 50 | vendor.CompanyName = null; 51 | var expected = "Message sent: Hello"; 52 | 53 | // Act 54 | var actual = vendor.SendWelcomeEmail("Test Message"); 55 | 56 | // Assert 57 | Assert.AreEqual(expected, actual); 58 | } 59 | 60 | [TestMethod()] 61 | public void PlaceOrderTest() 62 | { 63 | // Arrange 64 | var vendor = new Vendor(); 65 | var product = new Product(1, "Saw", ""); 66 | var expected = new OperationResult(true, 67 | "Order from Acme, Inc\r\nProduct: Saw\r\nQuantity: 12" + 68 | "\r\nInstructions: standard delivery"); 69 | 70 | // Act 71 | var actual = vendor.PlaceOrder(product, 12); 72 | 73 | // Assert 74 | Assert.AreEqual(expected.Success, actual.Success); 75 | Assert.AreEqual(expected.Message, actual.Message); 76 | } 77 | [TestMethod()] 78 | public void PlaceOrder_3Parameters() 79 | { 80 | // Arrange 81 | var vendor = new Vendor(); 82 | var product = new Product(1, "Saw", ""); 83 | var expected = new OperationResult(true, 84 | "Order from Acme, Inc\r\nProduct: Saw\r\nQuantity: 12" + 85 | "\r\nDeliver By: " + new DateTime(2018,10,25).ToString("d") + 86 | "\r\nInstructions: standard delivery"); 87 | 88 | // Act 89 | var actual = vendor.PlaceOrder(product, 12, 90 | new DateTimeOffset(2018, 10, 25, 0, 0, 0, new TimeSpan(-7, 0, 0))); 91 | 92 | // Assert 93 | Assert.AreEqual(expected.Success, actual.Success); 94 | Assert.AreEqual(expected.Message, actual.Message); 95 | } 96 | 97 | [TestMethod()] 98 | [ExpectedException(typeof(ArgumentNullException))] 99 | public void PlaceOrder_NullProduct_Exception() 100 | { 101 | // Arrange 102 | var vendor = new Vendor(); 103 | 104 | // Act 105 | var actual = vendor.PlaceOrder(null, 12); 106 | 107 | // Assert 108 | // Expected exception 109 | } 110 | 111 | [TestMethod()] 112 | public void PlaceOrder_NoDeliveryDate() 113 | { 114 | // Arrange 115 | var vendor = new Vendor(); 116 | var product = new Product(1, "Saw", ""); 117 | var expected = new OperationResult(true, 118 | "Order from Acme, Inc\r\nProduct: Saw\r\nQuantity: 12" + 119 | "\r\nInstructions: Deliver to Suite 42"); 120 | 121 | // Act 122 | var actual = vendor.PlaceOrder(product, 12, 123 | instructions: "Deliver to Suite 42"); 124 | 125 | // Assert 126 | Assert.AreEqual(expected.Success, actual.Success); 127 | Assert.AreEqual(expected.Message, actual.Message); 128 | } 129 | 130 | [TestMethod()] 131 | public void ToStringTest() 132 | { 133 | // Arrange 134 | var vendor = new Vendor(); 135 | vendor.VendorId = 1; 136 | vendor.CompanyName = "ABC Corp"; 137 | var expected = "Vendor: ABC Corp (1)"; 138 | 139 | // Act 140 | var actual = vendor.ToString(); 141 | 142 | // Assert 143 | Assert.AreEqual(expected, actual); 144 | } 145 | } 146 | } -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Tests/Acme.CommonTests/Acme.CommonTests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {811EE95C-ED43-4601-BFAB-E75B41FD263A} 7 | Library 8 | Properties 9 | Acme.CommonTests 10 | Acme.CommonTests 11 | v4.6 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | {931B808F-2620-4B71-9F23-680F3BA90E6B} 61 | Acme.Common 62 | 63 | 64 | 65 | 66 | 67 | 68 | False 69 | 70 | 71 | False 72 | 73 | 74 | False 75 | 76 | 77 | False 78 | 79 | 80 | 81 | 82 | 83 | 84 | 91 | -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Tests/Acme.CommonTests/EmailServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace Acme.Common.Tests 4 | { 5 | [TestClass()] 6 | public class EmailServiceTests 7 | { 8 | [TestMethod()] 9 | public void SendMessage_Success() 10 | { 11 | // Arrange 12 | var email = new EmailService(); 13 | var expected = "Message sent: Test Message"; 14 | 15 | // Act 16 | var actual = email.SendMessage("Test Message", 17 | "This is a test message", "abc@abc.com"); 18 | 19 | // Assert 20 | Assert.AreEqual(expected, actual); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Tests/Acme.CommonTests/LoggingServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Acme.Common; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Acme.Common.Tests 10 | { 11 | [TestClass()] 12 | public class LoggingServiceTests 13 | { 14 | [TestMethod()] 15 | public void LogAction_Success() 16 | { 17 | // Arrange 18 | var expected = "Action: Test Action"; 19 | 20 | // Act 21 | var actual = LoggingService.LogAction("Test Action"); 22 | 23 | // Assert 24 | Assert.AreEqual(expected, actual); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /AcmeApp-For VS2013/Tests/Acme.CommonTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Acme.CommonTests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 12 | [assembly: AssemblyProduct("Acme.CommonTests")] 13 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("811ee95c-ed43-4601-bfab-e75b41fd263a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Biz/Acme.Biz.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {5C818AB4-0B33-4802-933D-11210EB5C229} 8 | Library 9 | Properties 10 | Acme.Biz 11 | Acme.Biz 12 | v4.6 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | {931b808f-2620-4b71-9f23-680f3ba90e6b} 51 | Acme.Common 52 | 53 | 54 | 55 | 62 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Biz/Product.cs: -------------------------------------------------------------------------------- 1 | using Acme.Common; 2 | using static Acme.Common.LoggingService; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Acme.Biz 10 | { 11 | /// 12 | /// Manages products carried in inventory. 13 | /// 14 | public class Product 15 | { 16 | #region Constructors 17 | public Product() 18 | { 19 | } 20 | public Product(int productId, 21 | string productName, 22 | string description) : this() 23 | { 24 | this.ProductId = productId; 25 | this.ProductName = productName; 26 | this.Description = description; 27 | } 28 | #endregion 29 | 30 | #region Properties 31 | public DateTime? AvailabilityDate { get; set; } 32 | 33 | public decimal Cost { get; set; } 34 | 35 | public string Description { get; set; } 36 | 37 | public int ProductId { get; set; } 38 | 39 | private string productName; 40 | public string ProductName 41 | { 42 | get { 43 | var formattedValue = productName?.Trim(); 44 | return formattedValue; 45 | } 46 | set 47 | { 48 | if (value.Length < 3) 49 | { 50 | ValidationMessage = "Product Name must be at least 3 characters"; 51 | } 52 | else if (value.Length > 20) 53 | { 54 | ValidationMessage = "Product Name cannot be more than 20 characters"; 55 | 56 | } 57 | else 58 | { 59 | productName = value; 60 | 61 | } 62 | } 63 | } 64 | 65 | private Vendor productVendor; 66 | public Vendor ProductVendor 67 | { 68 | get { 69 | if (productVendor == null) 70 | { 71 | productVendor = new Vendor(); 72 | } 73 | return productVendor; 74 | } 75 | set { productVendor = value; } 76 | } 77 | 78 | public string ValidationMessage { get; private set; } 79 | 80 | #endregion 81 | 82 | /// 83 | /// Calculates the suggested retail price 84 | /// 85 | /// Percent used to mark up the cost. 86 | /// 87 | public decimal CalculateSuggestedPrice(decimal markupPercent) => 88 | this.Cost + (this.Cost * markupPercent / 100); 89 | 90 | public override string ToString() 91 | { 92 | return this.ProductName + " (" + this.ProductId + ")"; 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Biz/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Acme.Biz")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 12 | [assembly: AssemblyProduct("Acme.Biz")] 13 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | [assembly: InternalsVisibleTo("Acme.BizTests")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("5c818ab4-0b33-4802-933d-11210eb5c229")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("1.0.0.0")] 37 | [assembly: AssemblyFileVersion("1.0.0.0")] 38 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Biz/Vendor.cs: -------------------------------------------------------------------------------- 1 | using Acme.Common; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Acme.Biz 9 | { 10 | /// 11 | /// Manages the approved vendors from whom Acme purchases our inventory. 12 | /// 13 | public class Vendor 14 | { 15 | public int VendorId { get; set; } 16 | public string CompanyName { get; set; } 17 | public string Email { get; set; } 18 | 19 | /// 20 | /// Sends a product order to the vendor. 21 | /// 22 | /// Product to order. 23 | /// Quantity of the product to order. 24 | /// Requested delivery date. 25 | /// Delivery instructions. 26 | /// 27 | public OperationResult PlaceOrder(Product product, int quantity, 28 | DateTimeOffset? deliverBy = null, 29 | string instructions = "standard delivery") 30 | { 31 | if (product == null) 32 | throw new ArgumentNullException(nameof(product)); 33 | if (quantity <= 0) 34 | throw new ArgumentOutOfRangeException(nameof(quantity)); 35 | if (deliverBy <= DateTimeOffset.Now) 36 | throw new ArgumentOutOfRangeException(nameof(deliverBy)); 37 | 38 | var success = false; 39 | 40 | var orderTextBuilder = new StringBuilder("Order from Acme, Inc" + 41 | System.Environment.NewLine + 42 | "Product: " + product.ProductName + 43 | System.Environment.NewLine + 44 | "Quantity: " + quantity); 45 | if (deliverBy.HasValue) 46 | { 47 | orderTextBuilder.Append( System.Environment.NewLine + 48 | "Deliver By: " + deliverBy.Value.ToString("d")); 49 | } 50 | if (!String.IsNullOrWhiteSpace(instructions)) 51 | { 52 | orderTextBuilder.Append( System.Environment.NewLine + 53 | "Instructions: " + instructions); 54 | } 55 | var orderText = orderTextBuilder.ToString(); 56 | 57 | var emailService = new EmailService(); 58 | var confirmation = emailService.SendMessage("New Order", orderText, 59 | this.Email); 60 | if (confirmation.StartsWith("Message sent:")) 61 | { 62 | success = true; 63 | } 64 | var operationResult = new OperationResult(success, orderText); 65 | return operationResult; 66 | } 67 | 68 | public override string ToString() 69 | { 70 | return $"Vendor: {this.CompanyName} ({this.VendorId})"; 71 | } 72 | 73 | 74 | /// 75 | /// Sends an email to welcome a new vendor. 76 | /// 77 | /// 78 | public string SendWelcomeEmail(string message) 79 | { 80 | var emailService = new EmailService(); 81 | var subject = ("Hello " + this.CompanyName).Trim(); 82 | var confirmation = emailService.SendMessage(subject, 83 | message, 84 | this.Email); 85 | return confirmation; 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Biz/VendorRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Acme.Biz 8 | { 9 | public class VendorRepository 10 | { 11 | /// 12 | /// Retrieve one vendor. 13 | /// 14 | /// Id of the vendor to retrieve. 15 | public Vendor Retrieve(int vendorId) 16 | { 17 | // Create the instance of the Vendor class 18 | Vendor vendor = new Vendor(); 19 | 20 | // Code that retrieves the defined customer 21 | 22 | // Temporary hard coded values to return 23 | if (vendorId == 1) 24 | { 25 | vendor.VendorId = 1; 26 | vendor.CompanyName = "ABC Corp"; 27 | vendor.Email = "abc@abc.com"; 28 | } 29 | return vendor; 30 | } 31 | 32 | /// 33 | /// Save data for one vendor. 34 | /// 35 | /// Instance of the vendor to save. 36 | /// 37 | public bool Save(Vendor vendor) 38 | { 39 | var success = true; 40 | 41 | // Code that saves the vendor 42 | 43 | return success; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Common/Acme.Common.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {931B808F-2620-4B71-9F23-680F3BA90E6B} 8 | Library 9 | Properties 10 | Acme.Common 11 | Acme.Common 12 | v4.6 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Common/EmailService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Acme.Common 8 | { 9 | /// 10 | /// Provides services to send email. 11 | /// 12 | public class EmailService 13 | { 14 | /// 15 | /// Sends email message 16 | /// 17 | /// Subject of the message. 18 | /// Message text 19 | /// Email address of the message recipient. 20 | /// 21 | public string SendMessage(string subject, string message, 22 | string recipient) 23 | { 24 | // Code to send an email 25 | 26 | var confirmation = "Message sent: " + subject; 27 | LoggingService.LogAction(confirmation); 28 | return confirmation; 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Common/LoggingService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Acme.Common 8 | { 9 | /// 10 | /// Provides logging. 11 | /// 12 | public static class LoggingService 13 | { 14 | /// 15 | /// Logs actions. 16 | /// 17 | /// Action to log. 18 | public static string LogAction(string action) 19 | { 20 | var logText = "Action: " + action; 21 | Console.WriteLine(logText); 22 | 23 | return logText; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Common/OperationResult.cs: -------------------------------------------------------------------------------- 1 | namespace Acme.Common 2 | { 3 | /// 4 | /// Provides a success flag and message 5 | /// useful as a method return type. 6 | /// 7 | public class OperationResult 8 | { 9 | public OperationResult() 10 | { 11 | } 12 | 13 | public OperationResult(bool success, string message) : this() 14 | { 15 | this.Success = success; 16 | this.Message = message; 17 | } 18 | 19 | public bool Success { get; set; } 20 | public string Message { get; set; } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Acme.Common")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 12 | [assembly: AssemblyProduct("Acme.Common")] 13 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("931b808f-2620-4b71-9f23-680f3ba90e6b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Win/Acme.Win.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A22E0D0A-25D7-428F-978C-364C2A4CAE81} 8 | WinExe 9 | Properties 10 | Acme.Win 11 | Acme.Win 12 | v4.6 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Form 51 | 52 | 53 | VendorWin.cs 54 | 55 | 56 | 57 | 58 | ResXFileCodeGenerator 59 | Resources.Designer.cs 60 | Designer 61 | 62 | 63 | True 64 | Resources.resx 65 | 66 | 67 | VendorWin.cs 68 | 69 | 70 | SettingsSingleFileGenerator 71 | Settings.Designer.cs 72 | 73 | 74 | True 75 | Settings.settings 76 | True 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | {5c818ab4-0b33-4802-933d-11210eb5c229} 85 | Acme.Biz 86 | 87 | 88 | 89 | 96 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Win/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Win/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace Acme.Win 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new VendorWin()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Win/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Acme.Win")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 12 | [assembly: AssemblyProduct("Acme.Win")] 13 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a22e0d0a-25d7-428f-978c-364c2a4cae81")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Win/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Acme.Win.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Acme.Win.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Win/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Win/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Acme.Win.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Win/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Win/VendorWin.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Acme.Win 2 | { 3 | partial class VendorWin 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.label1 = new System.Windows.Forms.Label(); 32 | this.CompanyNameTextBox = new System.Windows.Forms.TextBox(); 33 | this.EmailTextBox = new System.Windows.Forms.TextBox(); 34 | this.label2 = new System.Windows.Forms.Label(); 35 | this.CancelChangesButton = new System.Windows.Forms.Button(); 36 | this.SaveButton = new System.Windows.Forms.Button(); 37 | this.SuspendLayout(); 38 | // 39 | // label1 40 | // 41 | this.label1.AutoSize = true; 42 | this.label1.Location = new System.Drawing.Point(13, 13); 43 | this.label1.Name = "label1"; 44 | this.label1.Size = new System.Drawing.Size(82, 13); 45 | this.label1.TabIndex = 0; 46 | this.label1.Text = "Company Name"; 47 | // 48 | // CompanyNameTextBox 49 | // 50 | this.CompanyNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 51 | | System.Windows.Forms.AnchorStyles.Right))); 52 | this.CompanyNameTextBox.Location = new System.Drawing.Point(13, 30); 53 | this.CompanyNameTextBox.Name = "CompanyNameTextBox"; 54 | this.CompanyNameTextBox.Size = new System.Drawing.Size(275, 20); 55 | this.CompanyNameTextBox.TabIndex = 1; 56 | // 57 | // EmailTextBox 58 | // 59 | this.EmailTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 60 | | System.Windows.Forms.AnchorStyles.Right))); 61 | this.EmailTextBox.Location = new System.Drawing.Point(16, 71); 62 | this.EmailTextBox.Name = "EmailTextBox"; 63 | this.EmailTextBox.Size = new System.Drawing.Size(275, 20); 64 | this.EmailTextBox.TabIndex = 3; 65 | // 66 | // label2 67 | // 68 | this.label2.AutoSize = true; 69 | this.label2.Location = new System.Drawing.Point(16, 54); 70 | this.label2.Name = "label2"; 71 | this.label2.Size = new System.Drawing.Size(76, 13); 72 | this.label2.TabIndex = 2; 73 | this.label2.Text = "Email Address:"; 74 | // 75 | // CancelChangesButton 76 | // 77 | this.CancelChangesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 78 | this.CancelChangesButton.CausesValidation = false; 79 | this.CancelChangesButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 80 | this.CancelChangesButton.Location = new System.Drawing.Point(214, 143); 81 | this.CancelChangesButton.Name = "CancelChangesButton"; 82 | this.CancelChangesButton.Size = new System.Drawing.Size(75, 23); 83 | this.CancelChangesButton.TabIndex = 4; 84 | this.CancelChangesButton.Text = "Cancel"; 85 | this.CancelChangesButton.UseVisualStyleBackColor = true; 86 | this.CancelChangesButton.Click += new System.EventHandler(this.CancelChangesButton_Click); 87 | // 88 | // SaveButton 89 | // 90 | this.SaveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 91 | this.SaveButton.DialogResult = System.Windows.Forms.DialogResult.OK; 92 | this.SaveButton.Location = new System.Drawing.Point(133, 143); 93 | this.SaveButton.Name = "SaveButton"; 94 | this.SaveButton.Size = new System.Drawing.Size(75, 23); 95 | this.SaveButton.TabIndex = 5; 96 | this.SaveButton.Text = "Save"; 97 | this.SaveButton.UseVisualStyleBackColor = true; 98 | this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click); 99 | // 100 | // VendorWin 101 | // 102 | this.AcceptButton = this.SaveButton; 103 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 104 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 105 | this.ClientSize = new System.Drawing.Size(301, 178); 106 | this.Controls.Add(this.SaveButton); 107 | this.Controls.Add(this.CancelChangesButton); 108 | this.Controls.Add(this.EmailTextBox); 109 | this.Controls.Add(this.label2); 110 | this.Controls.Add(this.CompanyNameTextBox); 111 | this.Controls.Add(this.label1); 112 | this.MinimumSize = new System.Drawing.Size(301, 187); 113 | this.Name = "VendorWin"; 114 | this.Text = "Vendor Detail"; 115 | this.Load += new System.EventHandler(this.Vendor_Load); 116 | this.ResumeLayout(false); 117 | this.PerformLayout(); 118 | 119 | } 120 | 121 | #endregion 122 | 123 | private System.Windows.Forms.Label label1; 124 | private System.Windows.Forms.TextBox CompanyNameTextBox; 125 | private System.Windows.Forms.TextBox EmailTextBox; 126 | private System.Windows.Forms.Label label2; 127 | private System.Windows.Forms.Button CancelChangesButton; 128 | private System.Windows.Forms.Button SaveButton; 129 | } 130 | } 131 | 132 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Win/VendorWin.cs: -------------------------------------------------------------------------------- 1 | using Acme.Biz; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace Acme.Win 13 | { 14 | public partial class VendorWin : Form 15 | { 16 | Vendor currentVendor; 17 | VendorRepository vendorRepository; 18 | 19 | public VendorWin() 20 | { 21 | InitializeComponent(); 22 | } 23 | 24 | private void Vendor_Load(object sender, EventArgs e) 25 | { 26 | LoadData(); 27 | } 28 | 29 | private void SaveButton_Click(object sender, EventArgs e) 30 | { 31 | // Update the properties 32 | currentVendor.CompanyName = this.CompanyNameTextBox.Text; 33 | currentVendor.Email = this.EmailTextBox.Text; 34 | vendorRepository.Save(currentVendor); 35 | } 36 | 37 | private void CancelChangesButton_Click(object sender, EventArgs e) 38 | { 39 | LoadData(); 40 | } 41 | 42 | private void LoadData() 43 | { 44 | vendorRepository = new VendorRepository(); 45 | currentVendor = vendorRepository.Retrieve(1); 46 | 47 | // Populate the form 48 | this.CompanyNameTextBox.Text = currentVendor.CompanyName; 49 | this.EmailTextBox.Text = currentVendor.Email; 50 | } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Win/VendorWin.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/Acme.Wpf.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {42D49B3A-5F7B-4242-BC5C-66075496C895} 8 | WinExe 9 | Properties 10 | Acme.Wpf 11 | Acme.Wpf 12 | v4.6 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | true 17 | 18 | 19 | AnyCPU 20 | true 21 | full 22 | false 23 | bin\Debug\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | AnyCPU 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 4.0 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | MSBuild:Compile 56 | Designer 57 | 58 | 59 | 60 | VendorDetailView.xaml 61 | 62 | 63 | Designer 64 | MSBuild:Compile 65 | 66 | 67 | MSBuild:Compile 68 | Designer 69 | 70 | 71 | App.xaml 72 | Code 73 | 74 | 75 | MainWindow.xaml 76 | Code 77 | 78 | 79 | Designer 80 | MSBuild:Compile 81 | 82 | 83 | 84 | 85 | Code 86 | 87 | 88 | True 89 | True 90 | Resources.resx 91 | 92 | 93 | True 94 | Settings.settings 95 | True 96 | 97 | 98 | ResXFileCodeGenerator 99 | Resources.Designer.cs 100 | 101 | 102 | SettingsSingleFileGenerator 103 | Settings.Designer.cs 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | {5c818ab4-0b33-4802-933d-11210eb5c229} 114 | Acme.Biz 115 | 116 | 117 | 118 | 125 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace Acme.Wpf 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/Assets/StyleLibrary.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | Verdana 6 | 7 | Orange 9 | White 11 | Gray 13 | Black 15 | 16 | 19 | 22 | 25 | 26 | 28 | 29 | 32 | 35 | 36 | 37 | 38 | 54 | 55 | 68 | 69 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  8 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Acme.Wpf 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow : NavigationWindow 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("Acme.Wpf")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 14 | [assembly: AssemblyProduct("Acme.Wpf")] 15 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Acme.Wpf.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Acme.Wpf.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Acme.Wpf.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/ViewModels/VendorDetailViewModel.cs: -------------------------------------------------------------------------------- 1 | using Acme.Biz; 2 | 3 | namespace Acme.Wpf.ViewModels 4 | { 5 | public class VendorDetailViewModel 6 | { 7 | public Vendor currentVendor { get; set; } 8 | 9 | VendorRepository vendorRepository = new VendorRepository(); 10 | 11 | public VendorDetailViewModel() 12 | { 13 | LoadData(); 14 | } 15 | 16 | public void LoadData() 17 | { 18 | currentVendor = vendorRepository.Retrieve(1); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/Views/VendorDetailView.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 33 | 34 | 35 | 38 | 39 | 42 | 43 | 44 | 45 | 46 | 48 | 49 | 51 | 52 | 54 | 55 | 56 | 57 | 58 | 60 | 61 | 63 | 64 | 66 | 67 | 68 | 76 | 80 | 81 | 82 | 90 | 94 | 95 | 96 | 97 | 102 | 106 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /AcmeApp/Acme.Wpf/Views/VendorDetailView.xaml.cs: -------------------------------------------------------------------------------- 1 | using Acme.Biz; 2 | using Acme.Wpf.ViewModels; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | 6 | namespace Acme.Wpf.Views 7 | { 8 | /// 9 | /// Interaction logic for VendorDetailView.xaml 10 | /// 11 | public partial class VendorDetailView : Page 12 | { 13 | public VendorDetailView() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | private void SaveButton_Click(object sender, RoutedEventArgs e) 19 | { 20 | var vm = (VendorDetailViewModel)((Button)e.OriginalSource).DataContext; 21 | if (vm != null) 22 | { 23 | var vendorRepository = new VendorRepository(); 24 | vendorRepository.Save(vm.currentVendor); 25 | } 26 | } 27 | 28 | private void CancelButton_Click(object sender, RoutedEventArgs e) 29 | { 30 | this.NavigationService.Refresh(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /AcmeApp/AcmeApp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{551F9D44-8CC5-49B7-9EFD-4CC57CFDB504}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.Common", "Acme.Common\Acme.Common.csproj", "{931B808F-2620-4B71-9F23-680F3BA90E6B}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.CommonTests", "Tests\Acme.CommonTests\Acme.CommonTests.csproj", "{811EE95C-ED43-4601-BFAB-E75B41FD263A}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.Biz", "Acme.Biz\Acme.Biz.csproj", "{5C818AB4-0B33-4802-933D-11210EB5C229}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.BizTests", "Tests\Acme.BizTests\Acme.BizTests.csproj", "{8A097724-9C89-4645-9629-E9FA945E8695}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.Win", "Acme.Win\Acme.Win.csproj", "{A22E0D0A-25D7-428F-978C-364C2A4CAE81}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acme.Wpf", "Acme.Wpf\Acme.Wpf.csproj", "{42D49B3A-5F7B-4242-BC5C-66075496C895}" 19 | EndProject 20 | Global 21 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 22 | Debug|Any CPU = Debug|Any CPU 23 | Release|Any CPU = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 26 | {931B808F-2620-4B71-9F23-680F3BA90E6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {931B808F-2620-4B71-9F23-680F3BA90E6B}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {931B808F-2620-4B71-9F23-680F3BA90E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {931B808F-2620-4B71-9F23-680F3BA90E6B}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {811EE95C-ED43-4601-BFAB-E75B41FD263A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {811EE95C-ED43-4601-BFAB-E75B41FD263A}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {811EE95C-ED43-4601-BFAB-E75B41FD263A}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {811EE95C-ED43-4601-BFAB-E75B41FD263A}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {5C818AB4-0B33-4802-933D-11210EB5C229}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {5C818AB4-0B33-4802-933D-11210EB5C229}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {5C818AB4-0B33-4802-933D-11210EB5C229}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {5C818AB4-0B33-4802-933D-11210EB5C229}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {8A097724-9C89-4645-9629-E9FA945E8695}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {8A097724-9C89-4645-9629-E9FA945E8695}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {8A097724-9C89-4645-9629-E9FA945E8695}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {8A097724-9C89-4645-9629-E9FA945E8695}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {A22E0D0A-25D7-428F-978C-364C2A4CAE81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 43 | {A22E0D0A-25D7-428F-978C-364C2A4CAE81}.Debug|Any CPU.Build.0 = Debug|Any CPU 44 | {A22E0D0A-25D7-428F-978C-364C2A4CAE81}.Release|Any CPU.ActiveCfg = Release|Any CPU 45 | {A22E0D0A-25D7-428F-978C-364C2A4CAE81}.Release|Any CPU.Build.0 = Release|Any CPU 46 | {42D49B3A-5F7B-4242-BC5C-66075496C895}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 47 | {42D49B3A-5F7B-4242-BC5C-66075496C895}.Debug|Any CPU.Build.0 = Debug|Any CPU 48 | {42D49B3A-5F7B-4242-BC5C-66075496C895}.Release|Any CPU.ActiveCfg = Release|Any CPU 49 | {42D49B3A-5F7B-4242-BC5C-66075496C895}.Release|Any CPU.Build.0 = Release|Any CPU 50 | EndGlobalSection 51 | GlobalSection(SolutionProperties) = preSolution 52 | HideSolutionNode = FALSE 53 | EndGlobalSection 54 | GlobalSection(NestedProjects) = preSolution 55 | {811EE95C-ED43-4601-BFAB-E75B41FD263A} = {551F9D44-8CC5-49B7-9EFD-4CC57CFDB504} 56 | {8A097724-9C89-4645-9629-E9FA945E8695} = {551F9D44-8CC5-49B7-9EFD-4CC57CFDB504} 57 | EndGlobalSection 58 | EndGlobal 59 | -------------------------------------------------------------------------------- /AcmeApp/Tests/Acme.BizTests/Acme.BizTests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {8A097724-9C89-4645-9629-E9FA945E8695} 7 | Library 8 | Properties 9 | Acme.BizTests 10 | Acme.BizTests 11 | v4.6 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | {5c818ab4-0b33-4802-933d-11210eb5c229} 62 | Acme.Biz 63 | 64 | 65 | {931b808f-2620-4b71-9f23-680f3ba90e6b} 66 | Acme.Common 67 | 68 | 69 | 70 | 71 | 72 | 73 | False 74 | 75 | 76 | False 77 | 78 | 79 | False 80 | 81 | 82 | False 83 | 84 | 85 | 86 | 87 | 88 | 89 | 96 | -------------------------------------------------------------------------------- /AcmeApp/Tests/Acme.BizTests/ProductTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Acme.Biz; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Acme.Common; 9 | 10 | namespace Acme.Biz.Tests 11 | { 12 | [TestClass()] 13 | public class ProductTests 14 | { 15 | 16 | [TestMethod()] 17 | public void CalculateSuggestedPriceTest() 18 | { 19 | // Arrange 20 | var currentProduct = new Product(1, "Saw", ""); 21 | currentProduct.Cost = 50m; 22 | var expected = 55m; 23 | 24 | // Act 25 | var actual = currentProduct.CalculateSuggestedPrice(10m); 26 | 27 | // Assert 28 | Assert.AreEqual(expected, actual); 29 | } 30 | 31 | [TestMethod()] 32 | public void Product_Null() 33 | { 34 | //Arrange 35 | Product currentProduct = null; 36 | var companyName = currentProduct?.ProductVendor?.CompanyName; 37 | 38 | string expected = null; 39 | 40 | //Act 41 | var actual = companyName; 42 | 43 | //Assert 44 | Assert.AreEqual(expected, actual); 45 | } 46 | 47 | [TestMethod()] 48 | public void ProductName_Format() 49 | { 50 | //Arrange 51 | var currentProduct = new Product(); 52 | currentProduct.ProductName = " Steel Hammer "; 53 | 54 | var expected = "Steel Hammer"; 55 | 56 | //Act 57 | var actual = currentProduct.ProductName; 58 | 59 | //Assert 60 | Assert.AreEqual(expected, actual); 61 | } 62 | 63 | [TestMethod()] 64 | public void ProductName_TooShort() 65 | { 66 | //Arrange 67 | var currentProduct = new Product(); 68 | currentProduct.ProductName = "aw"; 69 | 70 | string expected = null; 71 | string expectedMessage = "Product Name must be at least 3 characters"; 72 | 73 | //Act 74 | var actual = currentProduct.ProductName; 75 | var actualMessage = currentProduct.ValidationMessage; 76 | 77 | //Assert 78 | Assert.AreEqual(expected, actual); 79 | Assert.AreEqual(expectedMessage, actualMessage); 80 | } 81 | 82 | [TestMethod()] 83 | public void ProductName_TooLong() 84 | { 85 | //Arrange 86 | var currentProduct = new Product(); 87 | currentProduct.ProductName = "Steel Bladed Hand Saw"; 88 | 89 | string expected = null; 90 | string expectedMessage = "Product Name cannot be more than 20 characters"; 91 | 92 | //Act 93 | var actual = currentProduct.ProductName; 94 | var actualMessage = currentProduct.ValidationMessage; 95 | 96 | //Assert 97 | Assert.AreEqual(expected, actual); 98 | Assert.AreEqual(expectedMessage, actualMessage); 99 | } 100 | 101 | [TestMethod()] 102 | public void ProductName_JustRight() 103 | { 104 | //Arrange 105 | var currentProduct = new Product(); 106 | currentProduct.ProductName = "Saw"; 107 | 108 | string expected = "Saw"; 109 | string expectedMessage = null; 110 | 111 | //Act 112 | var actual = currentProduct.ProductName; 113 | var actualMessage = currentProduct.ValidationMessage; 114 | 115 | //Assert 116 | Assert.AreEqual(expected, actual); 117 | Assert.AreEqual(expectedMessage, actualMessage); 118 | } 119 | 120 | } 121 | } -------------------------------------------------------------------------------- /AcmeApp/Tests/Acme.BizTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Acme.BizTests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 12 | [assembly: AssemblyProduct("Acme.BizTests")] 13 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8a097724-9c89-4645-9629-e9fa945e8695")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AcmeApp/Tests/Acme.BizTests/VendorRepositoryTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Acme.Biz; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Acme.Biz.Tests 10 | { 11 | [TestClass()] 12 | public class VendorRepositoryTests 13 | { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /AcmeApp/Tests/Acme.BizTests/VendorTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Acme.Biz; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Acme.Common; 9 | 10 | namespace Acme.Biz.Tests 11 | { 12 | [TestClass()] 13 | public class VendorTests 14 | { 15 | [TestMethod()] 16 | public void SendWelcomeEmail_ValidCompany_Success() 17 | { 18 | // Arrange 19 | var vendor = new Vendor(); 20 | vendor.CompanyName = "ABC Corp"; 21 | var expected = "Message sent: Hello ABC Corp"; 22 | 23 | // Act 24 | var actual = vendor.SendWelcomeEmail("Test Message"); 25 | 26 | // Assert 27 | Assert.AreEqual(expected, actual); 28 | } 29 | 30 | [TestMethod()] 31 | public void SendWelcomeEmail_EmptyCompany_Success() 32 | { 33 | // Arrange 34 | var vendor = new Vendor(); 35 | vendor.CompanyName = ""; 36 | var expected = "Message sent: Hello"; 37 | 38 | // Act 39 | var actual = vendor.SendWelcomeEmail("Test Message"); 40 | 41 | // Assert 42 | Assert.AreEqual(expected, actual); 43 | } 44 | 45 | [TestMethod()] 46 | public void SendWelcomeEmail_NullCompany_Success() 47 | { 48 | // Arrange 49 | var vendor = new Vendor(); 50 | vendor.CompanyName = null; 51 | var expected = "Message sent: Hello"; 52 | 53 | // Act 54 | var actual = vendor.SendWelcomeEmail("Test Message"); 55 | 56 | // Assert 57 | Assert.AreEqual(expected, actual); 58 | } 59 | 60 | [TestMethod()] 61 | public void PlaceOrderTest() 62 | { 63 | // Arrange 64 | var vendor = new Vendor(); 65 | var product = new Product(1, "Saw", ""); 66 | var expected = new OperationResult(true, 67 | "Order from Acme, Inc\r\nProduct: Saw\r\nQuantity: 12" + 68 | "\r\nInstructions: standard delivery"); 69 | 70 | // Act 71 | var actual = vendor.PlaceOrder(product, 12); 72 | 73 | // Assert 74 | Assert.AreEqual(expected.Success, actual.Success); 75 | Assert.AreEqual(expected.Message, actual.Message); 76 | } 77 | [TestMethod()] 78 | public void PlaceOrder_3Parameters() 79 | { 80 | // Arrange 81 | var vendor = new Vendor(); 82 | var product = new Product(1, "Saw", ""); 83 | var expected = new OperationResult(true, 84 | "Order from Acme, Inc\r\nProduct: Saw\r\nQuantity: 12" + 85 | "\r\nDeliver By: " + new DateTime(DateTime.Now.Year + 1, 10, 25).ToString("d") + 86 | "\r\nInstructions: standard delivery"); 87 | 88 | // Act 89 | var actual = vendor.PlaceOrder(product, 12, 90 | new DateTimeOffset(DateTime.Now.Year + 1, 10, 25, 0, 0, 0, new TimeSpan(-7, 0, 0))); 91 | 92 | // Assert 93 | Assert.AreEqual(expected.Success, actual.Success); 94 | Assert.AreEqual(expected.Message, actual.Message); 95 | } 96 | 97 | [TestMethod()] 98 | [ExpectedException(typeof(ArgumentNullException))] 99 | public void PlaceOrder_NullProduct_Exception() 100 | { 101 | // Arrange 102 | var vendor = new Vendor(); 103 | 104 | // Act 105 | var actual = vendor.PlaceOrder(null, 12); 106 | 107 | // Assert 108 | // Expected exception 109 | } 110 | 111 | [TestMethod()] 112 | public void PlaceOrder_NoDeliveryDate() 113 | { 114 | // Arrange 115 | var vendor = new Vendor(); 116 | var product = new Product(1, "Saw", ""); 117 | var expected = new OperationResult(true, 118 | "Order from Acme, Inc\r\nProduct: Saw\r\nQuantity: 12" + 119 | "\r\nInstructions: Deliver to Suite 42"); 120 | 121 | // Act 122 | var actual = vendor.PlaceOrder(product, 12, 123 | instructions: "Deliver to Suite 42"); 124 | 125 | // Assert 126 | Assert.AreEqual(expected.Success, actual.Success); 127 | Assert.AreEqual(expected.Message, actual.Message); 128 | } 129 | 130 | [TestMethod()] 131 | public void ToStringTest() 132 | { 133 | // Arrange 134 | var vendor = new Vendor(); 135 | vendor.VendorId = 1; 136 | vendor.CompanyName = "ABC Corp"; 137 | var expected = "Vendor: ABC Corp (1)"; 138 | 139 | // Act 140 | var actual = vendor.ToString(); 141 | 142 | // Assert 143 | Assert.AreEqual(expected, actual); 144 | } 145 | } 146 | } -------------------------------------------------------------------------------- /AcmeApp/Tests/Acme.CommonTests/Acme.CommonTests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {811EE95C-ED43-4601-BFAB-E75B41FD263A} 7 | Library 8 | Properties 9 | Acme.CommonTests 10 | Acme.CommonTests 11 | v4.6 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | {931B808F-2620-4B71-9F23-680F3BA90E6B} 61 | Acme.Common 62 | 63 | 64 | 65 | 66 | 67 | 68 | False 69 | 70 | 71 | False 72 | 73 | 74 | False 75 | 76 | 77 | False 78 | 79 | 80 | 81 | 82 | 83 | 84 | 91 | -------------------------------------------------------------------------------- /AcmeApp/Tests/Acme.CommonTests/EmailServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace Acme.Common.Tests 4 | { 5 | [TestClass()] 6 | public class EmailServiceTests 7 | { 8 | [TestMethod()] 9 | public void SendMessage_Success() 10 | { 11 | // Arrange 12 | var email = new EmailService(); 13 | var expected = "Message sent: Test Message"; 14 | 15 | // Act 16 | var actual = email.SendMessage("Test Message", 17 | "This is a test message", "abc@abc.com"); 18 | 19 | // Assert 20 | Assert.AreEqual(expected, actual); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /AcmeApp/Tests/Acme.CommonTests/LoggingServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Acme.Common; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Acme.Common.Tests 10 | { 11 | [TestClass()] 12 | public class LoggingServiceTests 13 | { 14 | [TestMethod()] 15 | public void LogAction_Success() 16 | { 17 | // Arrange 18 | var expected = "Action: Test Action"; 19 | 20 | // Act 21 | var actual = LoggingService.LogAction("Test Action"); 22 | 23 | // Assert 24 | Assert.AreEqual(expected, actual); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /AcmeApp/Tests/Acme.CommonTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Acme.CommonTests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("InStep Technologies, Inc.")] 12 | [assembly: AssemblyProduct("Acme.CommonTests")] 13 | [assembly: AssemblyCopyright("Copyright © InStep Technologies, Inc. 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("811ee95c-ed43-4601-bfab-e75b41fd263a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Deborah Kurata 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CSharpBP-Collections 2 | Materials and starter files for the "C# Best Practices: Collections and Generics" Pluralsight course. 3 | 4 | **NOTE: The `AcmeApp` sample code uses C# 6 and requires Visual Studio 2015 or higher.** 5 | 6 | If you are using VS 2013, use the `AcmeApp-For VS2013` version of the sample code. 7 | --------------------------------------------------------------------------------