コード例 #1
0
        public void GetDevicesOfType(string classificationName)
        {
            var deviceManager = new DeviceManager();
            var classification = new DeviceClass()
            {
                Name = classificationName
            };

            deviceManager.Devices = new List<IDevice>() {
                new Device()
                {
                    Classification = classification
                }
            };
            
            var devicesByClassification = deviceManager.GetDevicesOfType(classification);

            Assert.Equal(1, devicesByClassification.Count());
            Assert.Equal(classificationName, devicesByClassification.FirstOrDefault().Classification.Name);

            var devicesByClassificationName = deviceManager.GetDevicesOfType(classification);

            Assert.Equal(1, devicesByClassificationName.Count());
            Assert.Equal(classificationName, devicesByClassificationName.FirstOrDefault().Classification.Name);
        }
コード例 #2
0
        public void GetInstructionString(string deviceName, string instructionSetName, string instructionName, string instructionString)
        {
            var deviceManager = new DeviceManager();
            deviceManager.Devices = new List<IDevice>() {
                new Device()
                {
                    Name = deviceName,
                    InstructionSets = new List<InstructionSet>() { 
                        new InstructionSet()
                        {
                            Name = instructionSetName,
                            Instructions = new List<IInstruction>()
                            {
                                {
                                    new Instruction()
                                    {
                                        Name = instructionName,
                                        InstructionString = instructionString
                                    }
                                }
                            }
                        }
                    }
                }
            };

            Assert.Equal(instructionString, deviceManager.GetInstructionString(deviceName, instructionSetName, instructionName));
        }