public void Test_DrinkCanService_Add() { using (var mock = AutoMock.GetLoose()) { try { // Arrange - configure the mock var recDTO = new DrinkCanDTO() { Flavour = Flavour.Apple, IsSold = false, Price = 1.50m }; var service = mock.Create <DrinkCanService>(); // Act service.Add(recDTO); //Assert Assert.IsTrue(true); } catch { Assert.IsTrue(false); } } }
public void Add(DrinkCanDTO recDTO) { if (recDTO == null) { throw new ArgumentNullException(string.Format(ValidationConstants.SDataNotFoundWithValue, "DrinkCan")); } DrinkCan rec = DrinkCanMapper.Map(recDTO); _drinkCanRepository.Add(rec); }
public static DrinkCanDTO Map(DrinkCan source, DrinkCanDTO target = null) { if (source == null) { throw new ArgumentNullException("source"); } if (target == null) { target = new DrinkCanDTO(); } target.Flavour = source.Flavour; target.Price = source.Price; target.IsSold = source.IsSold; return(target); }