Esempio n. 1
0
        public static void SeedProductionLines(Context dbContext)
        {
            SeedMachines(dbContext);
            Machine machine = dbContext.Machines.FindAsync(new Guid("11111111-1111-1111-1111-111111111111")).Result;

            List <Machine> machines = new List <Machine>()
            {
                machine
            };
            ProductionLineDescription description    = new ProductionLineDescription("Linha1");
            ProductionLine            productionLine = new ProductionLine(description, machines);

            productionLine.Id = new Guid("12111111-1111-1111-1111-111111111111");

            dbContext.ProductionLines.Add(productionLine);
        }
        public async void EnsureProductionLineIsFoundById()
        {
            var context = ContextMocker.GetContextMock();

            ContextMocker.SeedProductionLines(context);

            var ProductionLineService = new ProductionLineService(context);


            var ProductionLineId                  = new Guid("12111111-1111-1111-1111-111111111111");
            var expectedProductionLineId          = new Guid("12111111-1111-1111-1111-111111111111");
            var expectedMachineId                 = new Guid("11111111-1111-1111-1111-111111111111");
            var expectedProductionLineDescription = new ProductionLineDescription("Linha1");
            var result = await ProductionLineService.GetProductionLineById(ProductionLineId);

            Assert.Equal(expectedProductionLineId, result.Id);
            Assert.Equal(expectedProductionLineDescription, result.Description);
            Assert.Equal(expectedMachineId, result.Machines[0].Id);
        }