public async Task NalogNePostoji_Greska()
        {
            var fakeRepo          = new Mock <INalogGKRepository>();
            var fakeNotifications = new Mock <INotificationQueue>();
            var fakeLogger        = new Mock <ILogger <NalogOtkljucanHandler> >();
            var evnt    = new NalogOtkljucan(Guid.NewGuid());
            var handler = new NalogOtkljucanHandler(fakeRepo.Object, fakeNotifications.Object, fakeLogger.Object);

            Func <Task> handle = async() => await handler.Handle(evnt, default);

            await Assert.ThrowsAsync <NalogNePostojiException>(handle);
        }
        public async Task Handle_Korektno()
        {
            var nalogIzBaze = new NalogGlavnaKnjiga()
            {
                Id        = Guid.NewGuid(),
                Zakljucan = true
            };
            var fakeRepo = new Mock <INalogGKRepository>();

            fakeRepo.Setup(x => x.GetAsync(nalogIzBaze.Id)).ReturnsAsync(nalogIzBaze);
            var fakeNotifications = new Mock <INotificationQueue>();
            var fakeLogger        = new Mock <ILogger <NalogOtkljucanHandler> >();
            var evnt = new NalogOtkljucan(nalogIzBaze.Id)
            {
                UserId = Guid.NewGuid().ToString()
            };
            var handler = new NalogOtkljucanHandler(fakeRepo.Object, fakeNotifications.Object, fakeLogger.Object);

            await handler.Handle(evnt, default);

            Assert.False(nalogIzBaze.Zakljucan);
            fakeNotifications.Verify(x => x.Add(It.Is <GlavnaKnjigaChanged>(n => n.UserId == evnt.UserId)));
        }
예제 #3
0
 internal void Primeni(NalogOtkljucan evnt)
 {
     Zakljucan = false;
 }