コード例 #1
0
        public async Task CheckStanAktualnyAfterPrzyjecie()
        {
            // Arrange
            var client    = _factory.CreateClient();
            var apiCaller = new PrzyjecieApiCaller(client);

            var tokens = await Authenticate(client).ConfigureAwait(false);

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tokens.Token);

            var magazynId = await new MagazynApiCaller(client).DodajMagazyn(MagazynObjectMother.GetMagazyn());
            var produktId = await new ProduktApiCaller(client).DodajProdukt(ProduktObjectMother.GetProdukt(magazynId));

            var przyjecieModel = new PrzyjecieCreateModel
            {
                MagazynId = magazynId,
                Data      = DateTime.Now,
                Pozycje   = new List <PrzyjeciePozycjaDokumentuCreateModel>
                {
                    new PrzyjeciePozycjaDokumentuCreateModel
                    {
                        ProduktId = produktId,
                        CenaNetto = 1M,
                        Ilosc     = 10,
                        StawkaVat = StawkaVat.DwadziesciaTrzyProcent
                    }
                }
            };

            await apiCaller.Przyjmij(przyjecieModel);

            var stany = await new StanAktualnyApiCaller(client).GetStanAktualny(magazynId);

            Assert.That(stany, Has.Count.EqualTo(1));
        }
コード例 #2
0
 public PrzyjmijCommand(Guid przedsiebiorstwoId, PrzyjecieCreateModel model)
 {
     Model = model;
     PrzedsiebiorstwoId = przedsiebiorstwoId;
 }
コード例 #3
0
 public Task <Guid> Przyjmij(PrzyjecieCreateModel model)
 {
     return(HttpClient.Post <Guid>("przyjecie/Przyjmij", model));
 }
コード例 #4
0
        public async Task <IActionResult> Przyjmij(PrzyjecieCreateModel model)
        {
            var id = await Mediator.Send(new PrzyjmijCommand(PrzedsiebiorstwoId, model));

            return(Ok(id));
        }