Last active
August 13, 2020 13:56
-
-
Save einarwh/bb4809047c366132374dae89ab6b5b43 to your computer and use it in GitHub Desktop.
A variation of shopping cart DTOs that violate C# naming standards for properties.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class ShoppingCart | |
{ | |
public ShoppingCart(string state) | |
{ | |
_state = state; | |
} | |
public string _state { get; } | |
} | |
public class EmptyCart : ShoppingCart | |
{ | |
public EmptyCart() : base("empty") {} | |
} | |
public class ActiveCart : ShoppingCart | |
{ | |
public ActiveCart() : base("active") { } | |
public Item[] unpaidItems { get; set; } | |
} | |
public class PaidCart : ShoppingCart | |
{ | |
public PaidCart() : base("paid") {} | |
public object[] paidItems { get; set; } | |
public Money payment { get; set; } | |
public string timestamp { get; set; } | |
} | |
public class Item | |
{ | |
public string id { get; set; } | |
public string title { get; set; } | |
public string description { get; set; } | |
} | |
public class Money | |
{ | |
public float amount { get; set; } | |
public string currency { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment