Esempio n. 1
0
        public static async void agua()
        {
            var rnd  = new Random();
            var foto = new Foto
            {
                FotCuidador   = "61C59C6B-C588-42DF-BE78-D35036E6E6CC",
                FotoDescricao = "teste",
                Id            = Guid.NewGuid().ToString(),
                FotoDados     = new byte[50],
            };

            rnd.NextBytes(foto.FotoDados);
            var material = new Material
            {
                MatDescricao  = "algo",
                MatQuantidade = 5,
                MatPacId      = "D1B9FA65-553D-456B-A2B7-1AF77E637981"
            };
            var x = new MaterialController();

            x.Request = new HttpRequestMessage(HttpMethod.Post, Uri.UriSchemeHttps);
            await x.PostMaterial(material);

            //var a = new FotoController();
            //await a.PostFoto(foto);
        }
Esempio n. 2
0
        public void AddValidMaterial()
        {
            var result = controller.PostMaterial(new Material {
                Name = "Test"
            }).Result;

            Assert.IsInstanceOfType(result, typeof(CreatedAtActionResult));

            if (result is ObjectResult res && res.Value is Material material)
            {
                Assert.IsInstanceOfType(material.Id, typeof(int));
            }
Esempio n. 3
0
        public static async Task GenerateSeedMaterialAsync(MaterialController sut)
        {
            var nameGenerator    = Arb.Generate <string>();
            var barcodeGenerator = Arb.Generate <string>();

            var materials = Gen.Choose(0, 10).Select(i =>
            {
                return(new Material
                {
                    Name = nameGenerator.Sample(10, 1).Head,
                    Barcode = barcodeGenerator.Sample(50, 1).Head,
                });
            });

            foreach (var item in materials.Sample(0, 10))
            {
                await sut.PostMaterial(item);
            }
        }