public async Task Handle_Korektno()
        {
            var nalogIzBaze = new NalogForm()
            {
                Id    = Guid.NewGuid(),
                Datum = new DateTime(2018, 10, 20),
                IdTip = 1,
                Opis  = "opis"
            };
            var fakeRepo = new Mock <INalogFormRepository>();

            fakeRepo.Setup(x => x.GetAsync(nalogIzBaze.Id)).ReturnsAsync(nalogIzBaze);
            var fakeLogger = new Mock <ILogger <IzmenjenoZaglavljeNalogaHandler> >();
            var evnt       = new IzmenjenoZaglavljeNaloga(nalogIzBaze.Id, new DateTime(2018, 10, 21), 2, "opis novi")
            {
                UserId = Guid.NewGuid().ToString()
            };
            var handler = new IzmenjenoZaglavljeNalogaHandler(fakeRepo.Object, fakeLogger.Object);

            await handler.Handle(evnt, default);

            Assert.Equal(new DateTime(2018, 10, 21), nalogIzBaze.Datum);
            Assert.Equal(2, nalogIzBaze.IdTip);
            Assert.Equal("opis novi", nalogIzBaze.Opis);
        }
Exemplo n.º 2
0
        public Task Handle(NalogOtvoren evnt, CancellationToken cancellationToken)
        {
            logger.LogTrace($"Handling IdNaloga: {evnt.IdNaloga}");
            NalogForm nalog = new NalogForm()
            {
                Id    = evnt.IdNaloga,
                IdTip = evnt.IdTip,
                Datum = evnt.DatumNaloga,
                Opis  = evnt.Opis,
            };

            nalogRepo.Add(nalog);
            return(Task.CompletedTask);
        }
Exemplo n.º 3
0
        public async Task Handle_Korektno()
        {
            var nalogIzBaze = new NalogForm()
            {
                Id = Guid.NewGuid(),
            };
            var fakeRepo = new Mock <INalogFormRepository>();

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

            await handler.Handle(evnt, default);

            fakeRepo.Verify(x => x.Remove(nalogIzBaze));
        }
Exemplo n.º 4
0
 public void Remove(NalogForm nalog)
 {
     context.NaloziForm.Remove(nalog);
 }
Exemplo n.º 5
0
 public void Add(NalogForm nalog)
 {
     context.NaloziForm.Add(nalog);
 }