Ejemplo n.º 1
0
        public FormulaCRUDTests()
        {
            repo        = new FakeFormulaRepository();
            controller  = new FormulasController(repo);
            noneMandrel = new Mandrel
            {
                MandrelID = 1,
                Name      = KnownObjects.NoneMandrel.Name,
                Radius    = KnownObjects.NoneMandrel.Radius
            };
            repo.AddMandrelAsync(noneMandrel);
            smallMandrel = new Mandrel
            {
                MandrelID = 2,
                Name      = KnownObjects.SmallMandrel.Name,
                Radius    = KnownObjects.SmallMandrel.Radius
            };
            repo.AddMandrelAsync(smallMandrel);
            mediumMandrel = new Mandrel
            {
                MandrelID = 3,
                Name      = KnownObjects.MediumMandrel.Name,
                Radius    = KnownObjects.MediumMandrel.Radius
            };
            repo.AddMandrelAsync(mediumMandrel);
            largeMandrel = new Mandrel
            {
                MandrelID = 4,
                Name      = KnownObjects.LargeMandrel.Name,
                Radius    = KnownObjects.LargeMandrel.Radius
            };
            repo.AddMandrelAsync(largeMandrel);

            f1 = new Formula
            {
                FormulaID = 1,
                BarSize   = 4,
                Degree    = 90,
                Mandrel   = smallMandrel,
                PinNumber = "16.5",
                InGained  = 1.5m
            };
            repo.AddFormulaAsync(f1);
            f2 = new Formula
            {
                FormulaID = 2,
                BarSize   = 5,
                Degree    = 90,
                Mandrel   = mediumMandrel,
                PinNumber = "15",
                InGained  = 2m
            };
            repo.AddFormulaAsync(f2);
        }
Ejemplo n.º 2
0
        public ReviewQuoteTests()
        {
            repoS = new FakeShapeRepository();
            quote = new Quote
            {
                QuoteID = 1
            };
            repoS.Quotes.Add(quote);
            shape = new Shape
            {
                ShapeID      = 1,
                BarSize      = 4,
                LegCount     = 3,
                Qty          = 30,
                NumCompleted = 0
            };
            cS = new CreateShape
            {
                Shape   = shape,
                QuoteID = quote.QuoteID
            };

            repoQ       = new FakeQuoteRepository();
            repoF       = new FakeFormulaRepository();
            repoC       = new FakeCostRepository();
            controllerQ = new QuotesController(repoQ, repoF, repoC, repoS);
            #region Mandrels
            mandrel1 = new Mandrel
            {
                MandrelID = 1,
                Name      = "Small",
                Radius    = 1
            };
            mandrel2 = new Mandrel
            {
                MandrelID = 2,
                Name      = "Medium",
                Radius    = 1.5m
            };
            #endregion
            #region Legs
            leg1 = new Leg
            {
                LegID   = 1,
                Length  = 36,
                Degree  = 90,
                Mandrel = mandrel2
            };
            leg2 = new Leg
            {
                LegID   = 2,
                Length  = 36,
                Degree  = 0,
                Mandrel = null
            };
            leg3 = new Leg
            {
                LegID   = 3,
                Length  = 12,
                Degree  = 90,
                Mandrel = mandrel2
            };
            leg4 = new Leg
            {
                LegID   = 4,
                Length  = 12,
                Degree  = 0,
                Mandrel = null
            };
            leg5 = new Leg
            {
                LegID   = 5,
                Length  = 30,
                Degree  = 90,
                Mandrel = mandrel1
            };
            leg6 = new Leg
            {
                LegID   = 6,
                Length  = 18,
                Degree  = 90,
                Mandrel = mandrel1
            };
            leg7 = new Leg
            {
                LegID   = 7,
                Length  = 30,
                Degree  = 0,
                Mandrel = null
            };
            #endregion
            #region Shapes
            shape2 = new Shape
            {
                ShapeID      = 2,
                BarSize      = 5,
                LegCount     = 2,
                Legs         = { leg1, leg2 },
                Qty          = 30,
                NumCompleted = 0
            };
            shape3 = new Shape
            {
                ShapeID      = 3,
                BarSize      = 5,
                LegCount     = 2,
                Legs         = { leg3, leg4 },
                Qty          = 60,
                NumCompleted = 0
            };
            shape4 = new Shape
            {
                ShapeID      = 4,
                BarSize      = 4,
                LegCount     = 3,
                Legs         = { leg5, leg6, leg7 },
                Qty          = 40,
                NumCompleted = 0
            };
            #endregion
            #region Costs
            cost1 = new Cost
            {
                CostID      = 1,
                Name        = KnownObjects.Bar4GlobalCost.Name,
                Price       = 10,
                LastChanged = new DateTime()
            };
            cost2 = new Cost
            {
                CostID      = 2,
                Name        = KnownObjects.Bar4CutCost.Name,
                Price       = 0.25m,
                LastChanged = new DateTime()
            };
            cost3 = new Cost
            {
                CostID      = 3,
                Name        = KnownObjects.Bar4BendCost.Name,
                Price       = 0.25m,
                LastChanged = new DateTime()
            };
            cost4 = new Cost
            {
                CostID      = 4,
                Name        = KnownObjects.Bar5GlobalCost.Name,
                Price       = 15,
                LastChanged = new DateTime()
            };
            cost5 = new Cost
            {
                CostID      = 5,
                Name        = KnownObjects.Bar5CutCost.Name,
                Price       = 0.33m,
                LastChanged = new DateTime()
            };
            cost6 = new Cost
            {
                CostID      = 6,
                Name        = KnownObjects.Bar5BendCost.Name,
                Price       = 0.33m,
                LastChanged = new DateTime()
            };
            cost7 = new Cost
            {
                CostID      = 7,
                Name        = KnownObjects.SetupCharge.Name,
                Price       = 15,
                LastChanged = new DateTime()
            };
            cost8 = new Cost
            {
                CostID      = 8,
                Name        = "4Bar",
                Price       = 10,
                LastChanged = new DateTime()
            };
            cost9 = new Cost
            {
                CostID      = 9,
                Name        = "4Cut",
                Price       = 0.25m,
                LastChanged = new DateTime()
            };
            cost10 = new Cost
            {
                CostID      = 10,
                Name        = "4Bend",
                Price       = 0.25m,
                LastChanged = new DateTime()
            };
            cost11 = new Cost
            {
                CostID      = 11,
                Name        = "5Bar",
                Price       = 15,
                LastChanged = new DateTime()
            };
            cost12 = new Cost
            {
                CostID      = 12,
                Name        = "5Cut",
                Price       = 0.33m,
                LastChanged = new DateTime()
            };
            cost13 = new Cost
            {
                CostID      = 13,
                Name        = "5Bend",
                Price       = 0.33m,
                LastChanged = new DateTime()
            };
            cost14 = new Cost
            {
                CostID      = 14,
                Name        = "Setup",
                Price       = 15,
                LastChanged = new DateTime()
            };
            #endregion
            #region Extra Costs
            cost15 = new Cost
            {
                CostID      = 15,
                Name        = KnownObjects.Bar3GlobalCost.Name,
                Price       = 10,
                LastChanged = new DateTime()
            };
            cost16 = new Cost
            {
                CostID      = 16,
                Name        = KnownObjects.Bar3CutCost.Name,
                Price       = 0.25m,
                LastChanged = new DateTime()
            };
            cost17 = new Cost
            {
                CostID      = 17,
                Name        = KnownObjects.Bar3BendCost.Name,
                Price       = 0.25m,
                LastChanged = new DateTime()
            };
            cost18 = new Cost
            {
                CostID      = 18,
                Name        = KnownObjects.Bar6GlobalCost.Name,
                Price       = 15,
                LastChanged = new DateTime()
            };
            cost19 = new Cost
            {
                CostID      = 19,
                Name        = KnownObjects.Bar6CutCost.Name,
                Price       = 0.33m,
                LastChanged = new DateTime()
            };
            cost20 = new Cost
            {
                CostID      = 20,
                Name        = KnownObjects.Bar6BendCost.Name,
                Price       = 0.33m,
                LastChanged = new DateTime()
            };
            #endregion
            quote2 = new Quote
            {
                QuoteID     = 2,
                Name        = "Bob's Concrete",
                OrderNum    = "123456",
                UseFormulas = true,
                Shapes      = { shape2, shape3, shape4 },
                Costs       = { cost8, cost9, cost10, cost11, cost12, cost13, cost14 },
                DateQuoted  = DateTime.Now,
                PickedUp    = false,
                Open        = false
            };
            repoC.AddCostAsync(cost1);
            repoC.AddCostAsync(cost2);
            repoC.AddCostAsync(cost3);
            repoC.AddCostAsync(cost4);
            repoC.AddCostAsync(cost5);
            repoC.AddCostAsync(cost6);
            repoC.AddCostAsync(cost7);
            repoC.AddCostAsync(cost15);
            repoC.AddCostAsync(cost16);
            repoC.AddCostAsync(cost17);
            repoC.AddCostAsync(cost18);
            repoC.AddCostAsync(cost19);
            repoC.AddCostAsync(cost20);
        }