Пример #1
0
        public void UpdateTeamName()
        {
            ProductionTeam team = new ProductionTeam("DayShift");

            team.Name = "NewDayShift";
            Assert.AreEqual<string>("NewDayShift", team.Name);
        }
Пример #2
0
        public void AddTwoProductionTeamsWithSameProductionTeamName()
        {
            RepositoryFactory factory = new RepositoryFactory();;
            ProductionTeam productionTeam1 = new ProductionTeam("Team A");
            ProductionTeam productionTeam2 = new ProductionTeam("Team A");

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(productionTeam1);
                repository.Save(productionTeam2);
            }
        }
Пример #3
0
        public void AddShift()
        {
            Production production = new Production("Machine A", new ProductNumber("11232"), new OrderNumber("1234"), 1000, 124);

            ProductionTeam team = new ProductionTeam("Team 1");

            DateTime start = new DateTime(2008, 10, 12, 8, 30, 0);

            ProductionShift shift = production.AddProductionShift(team, start);

            CollectionAssert.AreEquivalent(new [] { shift }, new List<ProductionShift>(production.Shifts));
        }
Пример #4
0
        public void AddNewProductionTeams()
        {
            RepositoryFactory factory = new RepositoryFactory();
            ProductionTeam productionTeam1 = new ProductionTeam("Team A");
            ProductionTeam productionTeam2 = new ProductionTeam("Team B");

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(productionTeam1);
                repository.Save(productionTeam2);
            }

            Assert.AreNotEqual(productionTeam1.Id, productionTeam2.Id);
        }
Пример #5
0
        public void AddShiftsOnDifferentDaysWithSameTeam()
        {
            Production production = new Production("Machine A", new ProductNumber("11232"), new OrderNumber("1234"), 1000, 124);

            ProductionTeam team = new ProductionTeam("Team 1");

            DateTime start1 = new DateTime(2008, 10, 12, 8, 30, 0);
            DateTime start2 = new DateTime(2008, 11, 12, 8, 30, 0);

            ProductionShift shift1 = production.AddProductionShift(team, start1);
            ProductionShift shift2 = production.AddProductionShift(team, start2);

            CollectionAssert.AreEquivalent(new [] { shift1, shift2 }, new List<ProductionShift>(production.Shifts));
        }
Пример #6
0
        public void CreateProductionLeg()
        {
            Production production = new Production("Machine A", new ProductNumber("11232"), new OrderNumber("1234"), 1000, 124);
            ProductionTeam team = new ProductionTeam("Team");
            DateTime start = new DateTime(2008, 10, 12, 8, 30, 0);
            ProductionShift shift = production.AddProductionShift(team, start.Date);

            long counterStart = 9956;

            ProductionLeg leg =  shift.AddProductionLeg(start, counterStart);

            Assert.AreEqual<DateTime>(start, leg.ProductionStart);
            Assert.AreEqual<long>(counterStart, leg.CounterStart);
        }
Пример #7
0
        public void AddNewProductionTeam()
        {
            RepositoryFactory factory = new RepositoryFactory();
            ProductionTeam productionTeam = new ProductionTeam("Team A");

            Assert.AreEqual(0, productionTeam.Id);
            Assert.AreEqual(0, productionTeam.Version);

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(productionTeam);
            }

            Assert.AreNotEqual(0, productionTeam.Id);
            Assert.AreNotEqual(0, productionTeam.Version);
        }
Пример #8
0
        public void DeleteProductionTeams()
        {
            RepositoryFactory factory = new RepositoryFactory();
            ProductionTeam productionTeam1 = new ProductionTeam("Team A");
            ProductionTeam productionTeam2 = new ProductionTeam("Team B");

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(productionTeam1);
                repository.Save(productionTeam2);
            }

            List<ProductionTeam> list = null;
            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                list = new List<ProductionTeam>(repository.LoadAll());
            }
            CollectionAssert.AreEquivalent(new ProductionTeam[] { productionTeam1, productionTeam2 }, list);

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Delete(productionTeam2);
            }
            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                list = new List<ProductionTeam>(repository.LoadAll());
            }
            CollectionAssert.AreEquivalent(new ProductionTeam[] { productionTeam1 }, list);

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Delete(productionTeam1);
            }
            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                list = new List<ProductionTeam>(repository.LoadAll());
            }
            CollectionAssert.AreEquivalent(new ProductionTeam[] { }, list);
        }
Пример #9
0
        public void UpdateProductionTeam()
        {
            RepositoryFactory factory = new RepositoryFactory();;
            ProductionTeam productionTeam = new ProductionTeam("Team A");

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(productionTeam);
            }

            productionTeam.Name = "Team B";

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(productionTeam);
            }

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                ProductionTeam loadedProductionTeam = repository.Load(productionTeam.Id);

                Assert.AreEqual(productionTeam, loadedProductionTeam);
                Assert.AreNotSame(productionTeam, loadedProductionTeam);
                Assert.AreEqual(productionTeam.Name, loadedProductionTeam.Name);
                Assert.AreEqual(productionTeam.GlobalId, loadedProductionTeam.GlobalId);
            }
        }
Пример #10
0
 public TeamItem(ProductionTeam team)
 {
     _team = team;
 }
Пример #11
0
        private ProductionShift FindExistingProductionShift(OrderNumber order, ProductionTeam team, DateTime date)
        {
            using(var repository = _repositoryFactory.CreateProductionQueryRepository())
            {
                Production p = repository.LoadProduction(order);
                if (p == null)
                    return null;

                foreach(var shift in p.Shifts)
                {
                    if (shift.Team.Equals(team) &&
                        shift.ProductionStart.Equals(date))

                        return shift;
                }

                return null;
            }
        }
Пример #12
0
 public ProductionTeamComboBoxItem(ProductionTeam productionTeam)
 {
     this._productionTeam = productionTeam;
 }
Пример #13
0
        public void AddShiftsOnSameDayWithSameTeam()
        {
            Production production = new Production("Machine A", new ProductNumber("11232"), new OrderNumber("1234"), 1000, 124);

            ProductionTeam team = new ProductionTeam("Team 1");

            DateTime start = new DateTime(2008, 10, 12, 8, 30, 0);

            ProductionShift shift1 = production.AddProductionShift(team, start);
            ProductionShift shift2 = production.AddProductionShift(team, start.AddHours(1));
        }
Пример #14
0
        public void CreateProductionTeam()
        {
            ProductionTeam team = new ProductionTeam("DayShift");

            Assert.AreEqual<string>("DayShift", team.Name);
        }
Пример #15
0
        public ProductionQuery AddTeam(ProductionTeam team)
        {
            ProductionQuery result = (ProductionQuery) this.MemberwiseClone();

            result.teams.Add(team);

            return result;
        }
Пример #16
0
 public GraphItem(string machine, DateTime productionDate, ProductionTeam team, IEnumerable<ProductionStopRegistration> stopRegistrations)
 {
     this.machine = machine;
     this.productionDate = productionDate;
     this.team = team;
     this.stopRegistrations = new List<ProductionStopRegistration>(stopRegistrations);
 }
Пример #17
0
        private ProductionShift CreateNewProductionShift(OrderNumber order, ProductionTeam team, DateTime date)
        {
            using (var repository = _repositoryFactory.CreateProductionQueryRepository())
            {
                Production p = repository.LoadProduction(order);

                using (var form = new StartShiftForm(p, date))
                {
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        if (p == null)
                        {
                            p =
                                SaveProduction(new Production(form.Machine, form.Product, order, form.ExpectedItems,
                                                              form.ProducedItemsPerHour, form.ValidatedSetupTime));

                            if (p == null)
                                return null;

                        }

                        SaveProduction(p);
                        var shift = p.AddProductionShift(team, form.StartTime.Date);
                        SaveShift(shift);
                        var leg = shift.AddProductionLeg(form.StartTime, form.StartCounter);
                        SaveLeg(leg);
                        SaveShift(shift);
                        SaveProduction(p);

                        return shift;
                    }

                    return null;
                }
            }
        }
Пример #18
0
        public void LoadProductionTeam()
        {
            RepositoryFactory factory = new RepositoryFactory();
            ProductionTeam productionTeam1 = new ProductionTeam("Team A");
            ProductionTeam productionTeam2 = new ProductionTeam("Team B");

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(productionTeam1);
                repository.Save(productionTeam2);
            }

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                foreach (ProductionTeam productionTeam in new ProductionTeam[] { productionTeam1, productionTeam2 })
                {
                    ProductionTeam loadedProductionTeam = repository.Load(productionTeam.Id);

                    Assert.AreEqual(productionTeam, loadedProductionTeam);
                    Assert.AreNotSame(productionTeam, loadedProductionTeam);
                    Assert.AreEqual(productionTeam.GlobalId, loadedProductionTeam.GlobalId);
                    Assert.AreEqual(productionTeam.Name, loadedProductionTeam.Name);
                }
            }
        }
Пример #19
0
        public void SetUp()
        {
            factory = new RepositoryFactory();;

            product1 = new ProductNumber("Product A");
            product2 = new ProductNumber("Product B");

            order1 = new OrderNumber("Order A");
            order2 = new OrderNumber("Order B");

            team1 = new ProductionTeam("Daghold");
            team2 = new ProductionTeam("Nathold");

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(team1);
                repository.Save(team2);
            }
        }
Пример #20
0
        public void SetUp()
        {
            factory = new RepositoryFactory();;

            product1 = new ProductNumber("Product A");
            product2 = new ProductNumber("Product B");

            order1 = new OrderNumber("Order A");
            order2 = new OrderNumber("Order B");

            production1 = new Production("Machine A", product1, order1, 1000, 100);
            production2 = new Production("Machine A", product2, order2, 500, 50);

            using (IEntityRepository<Production> repository = factory.CreateEntityRepository<Production>())
            {
                repository.Save(production1);
                repository.Save(production2);
            }

            team1 = new ProductionTeam("Daghold");
            team2 = new ProductionTeam("Nathold");

            using (IEntityRepository<ProductionTeam> repository = factory.CreateEntityRepository<ProductionTeam>())
            {
                repository.Save(team1);
                repository.Save(team2);
            }

            productionStop1 = new ProductionStop("Stop A");
            productionStop2 = new ProductionStop("Stop B");

            using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
            {
                repository.Save(productionStop1);
                repository.Save(productionStop2);
            }
        }