Skip to content
Permalink
Browse files

Moved model/DTO classes to Model project along with model-specific ex…

…tension methods
  • Loading branch information...
sumo300 committed Dec 19, 2013
1 parent 6b0b359 commit 6263ce37ec31471b124c305eca955ec9c87f63a4
Showing with 114 additions and 106 deletions.
  1. +2 −2 {SeeSharpShip → SeeSharpShip.Model}/Extensions/EnumExtensions.cs
  2. +1 −1 {SeeSharpShip → SeeSharpShip.Model}/Extensions/GuidExtensions.cs
  3. +1 −1 {SeeSharpShip → SeeSharpShip.Model}/Extensions/ModelExtensions.cs
  4. +32 −1 SeeSharpShip.Model/SeeSharpShip.Model.csproj
  5. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/Domestic/FirstClassMailTypes.cs
  6. +2 −2 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/Domestic/Request/DomesticPackage.cs
  7. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/Domestic/Request/RateV4Request.cs
  8. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/Domestic/Request/SpecialService.cs
  9. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/Domestic/Response/Package.cs
  10. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/Domestic/Response/Postage.cs
  11. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/Domestic/Response/RateV4Response.cs
  12. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/Domestic/Response/SpecialService.cs
  13. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/Domestic/ServiceTypes.cs
  14. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/IRateRequest.cs
  15. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/IRateResponse.cs
  16. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/International/Request/ExtraServices.cs
  17. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/International/Request/GlobalExpressGuaranteed.cs
  18. +2 −2 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/International/Request/InternationalPackage.cs
  19. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/International/Request/IntlRateV2Request.cs
  20. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/International/Request/MailType.cs
  21. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/International/Response/ExtraService.cs
  22. +2 −2 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/International/Response/IntlV2Response.cs
  23. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/International/Response/Package.cs
  24. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/International/Response/PostOffice.cs
  25. +2 −2 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/International/Response/Service.cs
  26. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/RequestError.cs
  27. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/TrackDetail.cs
  28. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/TrackId.cs
  29. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/TrackInfo.cs
  30. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/TrackRequest.cs
  31. +1 −1 {SeeSharpShip/Models → SeeSharpShip.Model}/Usps/TrackResponse.cs
  32. +1 −1 SeeSharpShip.Tests/FedEx/RateRequest.cs
  33. +6 −6 SeeSharpShip.Tests/FedEx/RateServiceTests.cs
  34. +2 −1 SeeSharpShip.Tests/ModelExtensionsTests.cs
  35. +5 −0 SeeSharpShip.Tests/SeeSharpShip.Tests.csproj
  36. +2 −2 SeeSharpShip.Tests/Usps/DomesticBuilders/DomesticRequest.cs
  37. +6 −5 SeeSharpShip.Tests/Usps/RateServiceTests.cs
  38. +3 −3 SeeSharpShip.Tests/Usps/RateServiceTestsData.cs
  39. +1 −1 SeeSharpShip.Tests/Usps/TrackServiceTests.cs
  40. +1 −33 SeeSharpShip/SeeSharpShip.csproj
  41. +4 −4 SeeSharpShip/Services/FedEx/RateService.cs
  42. +4 −4 SeeSharpShip/Services/Usps/IRateService.cs
  43. +1 −1 SeeSharpShip/Services/Usps/ITrackService.cs
  44. +7 −6 SeeSharpShip/Services/Usps/RateService.cs
  45. +2 −1 SeeSharpShip/Services/Usps/TrackService.cs
  46. +2 −2 Versioning/AssemblyVersionInfo.cs
@@ -1,4 +1,4 @@
#region SeeSharpShip is Copyright (C) 2011-2011 Michael J. Sumerano.
#region SeeSharpShip is Copyright (C) 2011-2011 Michael J. Sumerano.

// This file is part of SeeSharpShip.
//
@@ -21,7 +21,7 @@
using System.ComponentModel;
using System.Linq;

namespace SeeSharpShip.Extensions {
namespace SeeSharpShip.Model.Extensions {
public static class EnumExtensions {
public static string ToDescription(this Enum value) {
return (from m in value.GetType().GetMember(value.ToString())
@@ -20,7 +20,7 @@
using System;
using System.Linq;

namespace SeeSharpShip.Extensions {
namespace SeeSharpShip.Model.Extensions {
public static class GuidExtensions {
public static string ToShortId(this Guid value) {
long i = value.ToByteArray().Aggregate<byte, long>(1, (current, b) => current*((int) b + 1));
@@ -22,7 +22,7 @@
using System.Xml;
using System.Xml.Serialization;

namespace SeeSharpShip.Extensions {
namespace SeeSharpShip.Model.Extensions {
public static class ModelExtensions {
public static string ToXmlString<T>(this T value) where T : new() {
var serializer = new XmlSerializer(typeof (T), string.Empty);
@@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SeeSharpShip.Model</RootNamespace>
<AssemblyName>SeeSharpShip.Model</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -42,7 +43,37 @@
<Compile Include="..\Versioning\AssemblyVersionInfo.cs">
<Link>Properties\AssemblyVersionInfo.cs</Link>
</Compile>
<Compile Include="Extensions\EnumExtensions.cs" />
<Compile Include="Extensions\GuidExtensions.cs" />
<Compile Include="Extensions\ModelExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Usps\Domestic\FirstClassMailTypes.cs" />
<Compile Include="Usps\Domestic\Request\DomesticPackage.cs" />
<Compile Include="Usps\Domestic\Request\RateV4Request.cs" />
<Compile Include="Usps\Domestic\Request\SpecialService.cs" />
<Compile Include="Usps\Domestic\Response\Package.cs" />
<Compile Include="Usps\Domestic\Response\Postage.cs" />
<Compile Include="Usps\Domestic\Response\RateV4Response.cs" />
<Compile Include="Usps\Domestic\Response\SpecialService.cs" />
<Compile Include="Usps\Domestic\ServiceTypes.cs" />
<Compile Include="Usps\International\Request\ExtraServices.cs" />
<Compile Include="Usps\International\Request\GlobalExpressGuaranteed.cs" />
<Compile Include="Usps\International\Request\InternationalPackage.cs" />
<Compile Include="Usps\International\Request\IntlRateV2Request.cs" />
<Compile Include="Usps\International\Request\MailType.cs" />
<Compile Include="Usps\International\Response\ExtraService.cs" />
<Compile Include="Usps\International\Response\IntlV2Response.cs" />
<Compile Include="Usps\International\Response\Package.cs" />
<Compile Include="Usps\International\Response\PostOffice.cs" />
<Compile Include="Usps\International\Response\Service.cs" />
<Compile Include="Usps\IRateRequest.cs" />
<Compile Include="Usps\IRateResponse.cs" />
<Compile Include="Usps\RequestError.cs" />
<Compile Include="Usps\TrackDetail.cs" />
<Compile Include="Usps\TrackId.cs" />
<Compile Include="Usps\TrackInfo.cs" />
<Compile Include="Usps\TrackRequest.cs" />
<Compile Include="Usps\TrackResponse.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -17,7 +17,7 @@

#endregion

namespace SeeSharpShip.Models.Usps.Domestic {
namespace SeeSharpShip.Model.Usps.Domestic {
public enum FirstClassMailTypes {
Letter,
Flat,
@@ -19,9 +19,9 @@

using System;
using System.Xml.Serialization;
using SeeSharpShip.Extensions;
using SeeSharpShip.Model.Extensions;

namespace SeeSharpShip.Models.Usps.Domestic.Request {
namespace SeeSharpShip.Model.Usps.Domestic.Request {
public class DomesticPackage {
private string _container;

@@ -20,7 +20,7 @@
using System.Collections.Generic;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.Domestic.Request {
namespace SeeSharpShip.Model.Usps.Domestic.Request {
public class RateV4Request : IRateRequest {
public RateV4Request() {
// Enables full V4 rate functionality
@@ -19,7 +19,7 @@

using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.Domestic.Request {
namespace SeeSharpShip.Model.Usps.Domestic.Request {
public class SpecialServices {
[XmlElement("SpecialService")]
public string[] SpecialService { get; set; }
@@ -20,7 +20,7 @@
using System.Collections.Generic;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.Domestic.Response {
namespace SeeSharpShip.Model.Usps.Domestic.Response {
public class Package {
public string ZipOrigination { get; set; }
public string ZipDestination { get; set; }
@@ -21,7 +21,7 @@
using System.Collections.Generic;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.Domestic.Response {
namespace SeeSharpShip.Model.Usps.Domestic.Response {
public class Postage : IEquatable<Postage> {
[XmlAttribute(AttributeName = "CLASSID")]
public string ClassId { get; set; }
@@ -20,7 +20,7 @@
using System.Collections.Generic;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.Domestic.Response {
namespace SeeSharpShip.Model.Usps.Domestic.Response {
public class RateV4Response : IRateResponse {
[XmlElement("Package")]
public List<Package> Packages { get; set; }
@@ -19,7 +19,7 @@

using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.Domestic.Response {
namespace SeeSharpShip.Model.Usps.Domestic.Response {
public class SpecialService {
[XmlElement("ServiceID")]
public string ServiceId { get; set; }
@@ -19,7 +19,7 @@

using System.ComponentModel;

namespace SeeSharpShip.Models.Usps.Domestic {
namespace SeeSharpShip.Model.Usps.Domestic {
public enum ServiceTypes {
[Description("First Class")]
FirstClass,
@@ -19,7 +19,7 @@

using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps {
namespace SeeSharpShip.Model.Usps {
public interface IRateRequest {
/// <summary>
/// This attribute specifies your Web Tools ID. See the Developer's Guide for information on obtaining your USERID.
@@ -19,7 +19,7 @@

using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps {
namespace SeeSharpShip.Model.Usps {
public interface IRateResponse {
[XmlAttribute(AttributeName = "ID")]
string Id { get; set; }
@@ -19,7 +19,7 @@

using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.International.Request {
namespace SeeSharpShip.Model.Usps.International.Request {
public class ExtraServices {
[XmlElement("ExtraService")]
public string[] ExtraService { get; set; }
@@ -20,7 +20,7 @@
using System;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.International.Request {
namespace SeeSharpShip.Model.Usps.International.Request {
public abstract class GlobalExpressGuaranteed {
private string _giftFlag;
private string _poBoxFlag;
@@ -19,9 +19,9 @@

using System;
using System.Xml.Serialization;
using SeeSharpShip.Extensions;
using SeeSharpShip.Model.Extensions;

namespace SeeSharpShip.Models.Usps.International.Request {
namespace SeeSharpShip.Model.Usps.International.Request {
public class InternationalPackage {
private string _container;

@@ -20,7 +20,7 @@
using System.Collections.Generic;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.International.Request {
namespace SeeSharpShip.Model.Usps.International.Request {
public class IntlRateV2Request : IRateRequest {
public IntlRateV2Request() {
// Enables full V2 rate functionality
@@ -19,7 +19,7 @@

using System.ComponentModel;

namespace SeeSharpShip.Models.Usps.International.Request {
namespace SeeSharpShip.Model.Usps.International.Request {
public enum MailType {
All,
Package,
@@ -19,7 +19,7 @@

using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.International.Response {
namespace SeeSharpShip.Model.Usps.International.Response {
public class ExtraService {
[XmlElement("ServiceID")]
public string ServiceId { get; set; }
@@ -1,4 +1,4 @@
#region SeeSharpShip is Copyright (C) 2011-2011 Michael J. Sumerano.
#region SeeSharpShip is Copyright (C) 2011-2011 Michael J. Sumerano.

// This file is part of SeeSharpShip.
//
@@ -20,7 +20,7 @@
using System.Collections.Generic;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.International.Response {
namespace SeeSharpShip.Model.Usps.International.Response {
public class IntlRateV2Response : IRateResponse {
[XmlElement("Package")]
public List<Package> Packages { get; set; }
@@ -19,7 +19,7 @@

using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.International.Response {
namespace SeeSharpShip.Model.Usps.International.Response {
public class Package {
public string Prohibitions { get; set; }
public string Restrictions { get; set; }
@@ -19,7 +19,7 @@

using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps.International.Response {
namespace SeeSharpShip.Model.Usps.International.Response {
public class PostOffice {
public string Name { get; set; }
public string Address { get; set; }
@@ -19,9 +19,9 @@

using System.Collections.Generic;
using System.Xml.Serialization;
using SeeSharpShip.Models.Usps.International.Request;
using SeeSharpShip.Model.Usps.International.Request;

namespace SeeSharpShip.Models.Usps.International.Response {
namespace SeeSharpShip.Model.Usps.International.Response {
public class Service {
[XmlAttribute(AttributeName = "ID")]
public string Id { get; set; }
@@ -20,7 +20,7 @@
using System;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps {
namespace SeeSharpShip.Model.Usps {
[Serializable]
[XmlRoot("Error")]
public class RequestError {
@@ -20,7 +20,7 @@
using System;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps {
namespace SeeSharpShip.Model.Usps {
[Serializable]
public class TrackDetail {
[XmlText]
@@ -20,7 +20,7 @@
using System;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps {
namespace SeeSharpShip.Model.Usps {
[Serializable]
public class TrackId {
[XmlAttribute(AttributeName = "ID")]
@@ -22,7 +22,7 @@
using System.Xml.Schema;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps {
namespace SeeSharpShip.Model.Usps {
[Serializable]
[XmlType(AnonymousType = true)]
public class TrackInfo {
@@ -20,7 +20,7 @@
using System;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps {
namespace SeeSharpShip.Model.Usps {
[Serializable]
public class TrackRequest {
[XmlAttribute(AttributeName = "USERID")]
@@ -21,7 +21,7 @@
using System.Collections.Generic;
using System.Xml.Serialization;

namespace SeeSharpShip.Models.Usps {
namespace SeeSharpShip.Model.Usps {
[Serializable]
[XmlType(AnonymousType = true)]
[XmlRoot(Namespace = "", IsNullable = false)]
@@ -18,5 +18,5 @@
#endregion

namespace SeeSharpShip.Tests.FedEx {
public class RateRequest : ServiceProxies.RateRequest {}
//public class RateRequest : ServiceProxies.RateRequest {}
}
@@ -6,11 +6,11 @@ namespace SeeSharpShip.Tests.FedEx
[TestFixture]
public class RateServiceTests
{
[Test]
public void Get_EmptyRequest_ThrowsException() {
var service = new Services.FedEx.RateService();
RateRequest request = new RateRequest();
Assert.Throws(typeof(NotImplementedException), () => service.Get(request));
}
//[Test]
//public void Get_EmptyRequest_ThrowsException() {
// var service = new Services.FedEx.RateService();
// RateRequest request = new RateRequest();
// Assert.Throws(typeof(NotImplementedException), () => service.Get(request));
//}
}
}
@@ -20,7 +20,8 @@
using System;
using NUnit.Framework;
using SeeSharpShip.Extensions;
using SeeSharpShip.Models.Usps.Domestic;
using SeeSharpShip.Model.Extensions;
using SeeSharpShip.Model.Usps.Domestic;
using SeeSharpShip.Tests.Usps.DomesticBuilders;

namespace SeeSharpShip.Tests {
@@ -37,6 +37,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceModel" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Versioning\AssemblyVersionInfo.cs">
@@ -71,6 +72,10 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SeeSharpShip.Model\SeeSharpShip.Model.csproj">
<Project>{fc5a0764-decb-483a-86d7-87dfed5a4cac}</Project>
<Name>SeeSharpShip.Model</Name>
</ProjectReference>
<ProjectReference Include="..\SeeSharpShip\SeeSharpShip.csproj">
<Project>{4ABFD9BB-B5EB-404C-9407-0F0D437EAECE}</Project>
<Name>SeeSharpShip</Name>

0 comments on commit 6263ce3

Please sign in to comment.
You can’t perform that action at this time.