public async Task Handle_Korektno() { var fakeRepo = new Mock <INalogFormRepository>(); var fakeLogger = new Mock <ILogger <NalogOtvorenHandler> >(); var evnt = new NalogOtvoren(Guid.NewGuid(), new DateTime(2018, 10, 21), 2, "opis novi") { UserId = Guid.NewGuid().ToString() }; var handler = new NalogOtvorenHandler(fakeRepo.Object, fakeLogger.Object); await handler.Handle(evnt, default); fakeRepo.Verify(x => x.Add(It.Is <NalogForm>(n => n.Datum == new DateTime(2018, 10, 21) && n.IdTip == 2 && n.Opis == "opis novi"))); }
public async Task Handle_Korektno() { var fakeRepo = new Mock <INalogGKRepository>(); var fakeTipRepo = new Mock <ITipNalogaRepository>(); fakeTipRepo.Setup(x => x.GetAsync(2)).ReturnsAsync(new TipNaloga { Naziv = "Izvodi" }); var fakeNotifications = new Mock <INotificationQueue>(); var fakeLogger = new Mock <ILogger <NalogOtvorenHandler> >(); var evnt = new NalogOtvoren(Guid.NewGuid(), new DateTime(2018, 10, 21), 2, "opis novi") { UserId = Guid.NewGuid().ToString() }; var handler = new NalogOtvorenHandler(fakeRepo.Object, fakeTipRepo.Object, fakeNotifications.Object, fakeLogger.Object); await handler.Handle(evnt, default); fakeRepo.Verify(x => x.Add(It.Is <NalogGlavnaKnjiga>(n => n.Datum == new DateTime(2018, 10, 21) && n.TipNaziv == "Izvodi" && n.Opis == "opis novi"))); fakeNotifications.Verify(x => x.Add(It.Is <GlavnaKnjigaChanged>(n => n.UserId == evnt.UserId))); }