Esempio n. 1
0
        public void visit(CyPhy.Component component)
        {
            Logger.WriteDebug("visit(CyPhy.Component): {0}", component.Path);

            var part = new MfgBom.Bom.Part();

            // Check for a Property called "octopart_mpn"
            var octopart_mpn = component.Children.PropertyCollection.FirstOrDefault(p => p.Name == "octopart_mpn" &&
                                                                                    !String.IsNullOrWhiteSpace(p.Attributes.Value));

            if (octopart_mpn != null)
            {
                part.octopart_mpn = octopart_mpn.Attributes.Value;
            }

            var instance = new MfgBom.Bom.ComponentInstance()
            {
                gme_object_id = component.ID,
                path          = TrimPath(component.Path)
            };

            part.AddInstance(instance);

            bom.AddPart(part);
        }
        public void NoSuppliers()
        {
            var part = new MfgBom.Bom.Part();
            part.AddInstance(new MfgBom.Bom.ComponentInstance());
            part.SelectSupplier(1);

            Assert.Null(part.SelectedSupplierName);
            Assert.Null(part.SelectedSupplierPartCostPerUnit);
            Assert.Null(part.SelectedSupplierSku);
        }
Esempio n. 3
0
        public void NoSuppliers()
        {
            var part = new MfgBom.Bom.Part();

            part.AddInstance(new MfgBom.Bom.ComponentInstance());
            part.SelectSupplier(1);

            Assert.Null(part.SelectedSupplierName);
            Assert.Null(part.SelectedSupplierPartCostPerUnit);
            Assert.Null(part.SelectedSupplierSku);
        }
Esempio n. 4
0
        private static void SelectFPGASupplier(int design_quantity, float expected_cost)
        {
            var pathMockSellerMapStructure = Path.Combine(TEST_DIRECTORY,
                                                          "MockDataStructures",
                                                          "LFE3-17EA-6MG328C.SellerMapStructure.json");
            var jsonMockSellerMapStructure = File.ReadAllText(pathMockSellerMapStructure);

            var part = new MfgBom.Bom.Part()
            {
                SellerMapStructure = JsonConvert.DeserializeObject <MfgBom.Bom.Part.SellerMapStruct>(jsonMockSellerMapStructure)
            };

            part.AddInstance(new MfgBom.Bom.ComponentInstance());

            part.SelectSupplier(design_quantity);

            Assert.False(String.IsNullOrWhiteSpace(part.SelectedSupplierName));
            Assert.Equal("Digi-Key", part.SelectedSupplierName);
            Assert.Equal(expected_cost, part.SelectedSupplierPartCostPerUnit);
        }
Esempio n. 5
0
        public void NoUSDOffers()
        {
            var pathMockSellerMapStructure = Path.Combine(TEST_DIRECTORY,
                                                          "MockDataStructures",
                                                          "NoUSDOffers.SellerMapStructure.json");
            var jsonMockSellerMapStructure = File.ReadAllText(pathMockSellerMapStructure);

            var part = new MfgBom.Bom.Part()
            {
                SellerMapStructure = JsonConvert.DeserializeObject <MfgBom.Bom.Part.SellerMapStruct>(jsonMockSellerMapStructure)
            };

            part.AddInstance(new MfgBom.Bom.ComponentInstance());

            part.SelectSupplier(1);

            Assert.Null(part.SelectedSupplierName);
            Assert.Null(part.SelectedSupplierPartCostPerUnit);
            Assert.Null(part.SelectedSupplierSku);
        }
        public void visit(CyPhy.Component component)
        {
            Logger.WriteDebug("visit(CyPhy.Component): {0}", component.Path);
            
            var part = new MfgBom.Bom.Part();

            // Check for a Property called "octopart_mpn"
            var octopart_mpn = component.Children.PropertyCollection.FirstOrDefault(p => p.Name == "octopart_mpn" &&
                                                                                         !String.IsNullOrWhiteSpace(p.Attributes.Value));
            if (octopart_mpn != null)
            {
                part.octopart_mpn = octopart_mpn.Attributes.Value;
            }
            
            var instance = new MfgBom.Bom.ComponentInstance()
                                {
                                    gme_object_id = component.ID,
                                    path = TrimPath(component.Path)
                                };
            part.AddInstance(instance);
            
            bom.AddPart(part);
        }
        public void NoUSDOffers()
        {
            var pathMockSellerMapStructure = Path.Combine(TEST_DIRECTORY,
                                                          "MockDataStructures",
                                                          "NoUSDOffers.SellerMapStructure.json");
            var jsonMockSellerMapStructure = File.ReadAllText(pathMockSellerMapStructure);

            var part = new MfgBom.Bom.Part()
            {
                SellerMapStructure = JsonConvert.DeserializeObject<MfgBom.Bom.Part.SellerMapStruct>(jsonMockSellerMapStructure)
            };
            part.AddInstance(new MfgBom.Bom.ComponentInstance());

            part.SelectSupplier(1);

            Assert.Null(part.SelectedSupplierName);
            Assert.Null(part.SelectedSupplierPartCostPerUnit);
            Assert.Null(part.SelectedSupplierSku);
        }
        private static void SelectFPGASupplier(int design_quantity, float expected_cost)
        {
            var pathMockSellerMapStructure = Path.Combine(TEST_DIRECTORY,
                                                          "MockDataStructures",
                                                          "LFE3-17EA-6MG328C.SellerMapStructure.json");
            var jsonMockSellerMapStructure = File.ReadAllText(pathMockSellerMapStructure);

            var part = new MfgBom.Bom.Part()
            {
                SellerMapStructure = JsonConvert.DeserializeObject<MfgBom.Bom.Part.SellerMapStruct>(jsonMockSellerMapStructure)
            };
            part.AddInstance(new MfgBom.Bom.ComponentInstance());

            part.SelectSupplier(design_quantity);

            Assert.False(String.IsNullOrWhiteSpace(part.SelectedSupplierName));
            Assert.Equal("Digi-Key", part.SelectedSupplierName);
            Assert.Equal(expected_cost, part.SelectedSupplierPartCostPerUnit);
        }