void IGiftcardProductService.CreateGiftcard(string name, int price, bool isPriceOverrideable) { var giftcard = new GiftcardProduct(name, price); giftcard.SetPriceOverrideAble(isPriceOverrideable); _giftcardProductRepository.Insert(giftcard); }
public void IsPriceOverrideable_Should_Default_False() { //Arrange var product = new GiftcardProduct("TestItem", 1000); //Act //Assert Assert.False(product.IsPriceOverrideable); }
public static GiftcardProductDto Map(this GiftcardProduct giftcardProduct) { return(new GiftcardProductDto { Id = giftcardProduct.Id, IsPriceOverrideable = giftcardProduct.IsPriceOverrideable, Name = giftcardProduct.Name, Price = giftcardProduct.Price, }); }
public void Update_Description() { //Arrange var product = new GiftcardProduct("SomeName", "SomeDescription", 1000); //Act product.UpdateDescription("Description"); //Assert Assert.Equal("Description", product.Description); }
public void Update_Name() { //Arrange var product = new GiftcardProduct("SomeName", 1000); //Act product.UpdateName("NewName"); //Assert Assert.Equal("NewName", product.Name); }
public void Set_PriceOverrideable_True() { //Arrange var giftcardProduct = new GiftcardProduct("Test Item", 100); //Act giftcardProduct.SetPriceOverrideAble(true); //Assert Assert.True(giftcardProduct.IsPriceOverrideable); }
public void Be_Created_With_Name_And_Price() { //Arrange const string Name = "SomeName"; const int Price = 1000; //Act var giftCardProduct = new GiftcardProduct(Name, Price); //Assert Assert.Equal(Name, giftCardProduct.Name); Assert.Equal(Price, giftCardProduct.Price); }
public void AddOrderLine() { //Arrange var sut = new Order(); var product = new GiftcardProduct("MyTestGiftcardProduct", 1000); var orderLine = new OrderLine(1, product); //Act sut.AddOrderLine(orderLine); //Assert Assert.Equal(1, sut.OrderLineCount); }
public GiftCardOrderLine(GiftcardProduct giftcard, int amount, string message, string from, string to) : base(amount, giftcard) { if (string.IsNullOrWhiteSpace(message)) { throw new ArgumentException("Message must contain something", nameof(message)); } if (string.IsNullOrWhiteSpace(from)) { throw new ArgumentException("There has to be a sender", nameof(from)); } if (string.IsNullOrWhiteSpace(to)) { throw new ArgumentException("There has to be a receiver", nameof(to)); } Message = message; From = from; To = to; }
void IGiftcardProductService.CreateGiftcard(string name, int price) { var giftcard = new GiftcardProduct(name, price); _giftcardProductRepository.Insert(giftcard); }
void IBaseRepository <GiftcardProduct> .Update(GiftcardProduct entity) { throw new NotImplementedException(); }
async Task <GiftcardProduct> IBaseRepository <GiftcardProduct> .Get(int id) { var item = new GiftcardProduct("Something", 10); return(item); }