public void MaakNieuweKoffie() { Koffie = new Koffie(); Koffie.Melk = false; Koffie.Slagroom = false; Koffie.Suiker = false; Koffie.Type = "basic"; }
public void TestKoffieAddNull() { // Arrange Koffie newKoffie = null; // Act Action actionResult = () => _koffieAgent.Add(newKoffie); // Assert Assert.ThrowsException <ArgumentNullException>(actionResult); }
public void TestKoffieAddSameIdentifier() { // Arrange var newKoffie = new Koffie { Id = 1, Naam = "Cappuccino", MinimaleInhoudInCl = 12, MaximaleInhoudInCl = 25 }; // Act Action actionResult = () => _koffieAgent.Add(newKoffie); // Assert Assert.ThrowsException <ArgumentException>(actionResult); }
public void TestKoffieAddCount() { // Arrange var newKoffie = new Koffie { Id = 8, Naam = "Cappuccino", MinimaleInhoudInCl = 12, MaximaleInhoudInCl = 25 }; // Act _koffieAgent.Add(newKoffie); // Assert Assert.AreEqual(3, _koffieAgent.GetAll().Count()); }
public void TestKoffieAddContents() { // Arrange var newKoffie = new Koffie { Id = 8, Naam = "Cappuccino", MinimaleInhoudInCl = 12, MaximaleInhoudInCl = 25 }; // Act _koffieAgent.Add(newKoffie); // Assert var result = _koffieAgent.GetAll().Last(); Assert.AreEqual(newKoffie, result); }
public void Add(Koffie koffie) { if (koffie == null) { throw new ArgumentNullException(); } var existingKoffie = GetById(koffie.Id); if (existingKoffie != null) { throw new ArgumentException(); } _koffieList.Add(koffie); }
public void PostCallTest() { // Arrange var newKoffie = new Koffie { Id = 35, Naam = "Nieuwe Koffie" }; KoffieRepositoryMock koffieRepository = new KoffieRepositoryMock(); var target = new KoffieController(koffieRepository); // Act target.Post(newKoffie); // Assert Assert.AreEqual(1, koffieRepository.InsertCalled); Assert.AreEqual(newKoffie, koffieRepository.LastInsertKoffie); }
public void PutCallTest() { // Arrange var newKoffie = new Koffie { Id = 1, Naam = "Nieuwe Koffie" }; KoffieRepositoryMock koffieRepository = new KoffieRepositoryMock(); var target = new KoffieController(koffieRepository); // Act target.Put(newKoffie.Id, newKoffie); target.Put(newKoffie.Id, newKoffie); // Assert Assert.AreEqual(2, koffieRepository.UpdateCalled); Assert.AreEqual(newKoffie, koffieRepository.LastUpdateKoffie); }
public void TestKoffieAgentNewKoffieById() { // Arrange var newKoffie = new Koffie { Id = 16, Naam = "Latte Machiato", MinimaleInhoudInCl = 12, MaximaleInhoudInCl = 25 }; // Act _koffieAgent.Add(newKoffie); var result = _koffieAgent.GetById(newKoffie.Id); // Assert Assert.AreEqual(16, result.Id); Assert.AreEqual("Latte Machiato", result.Naam); Assert.AreEqual(12, result.MinimaleInhoudInCl); Assert.AreEqual(25, result.MaximaleInhoudInCl); }
public void Add(Koffie koffie) { _koffieList.Add(koffie); }
private void OnCoffeeReceived(Koffie koffie) { SelectedKoffie = koffie; }
public void Put(int id, [FromBody] Koffie value) { value.Id = id; _koffieRepository.Update(value); }
public void Post([FromBody] Koffie item) { _koffieRepository.Insert(item); }