コード例 #1
0
        public void PortIsFoundTest()
        {
            var port = new VideoPort { Name = "HDMI" };
            var port1 = new VideoPort { Name = "DVI" };
            var port2 = new VideoPort { Name = "VGA" };
            var collection = new VideoPortsCollection(new[] { port, port1, port2 });

            VideoPort found;
            var result = collection.TryGetPort(port1.Name, out found);

            Assert.IsTrue(result);
            Assert.AreEqual(port1, found);
        }
コード例 #2
0
ファイル: GadgetTests.cs プロジェクト: matry-ny/brain
        public void GadgetClonedProperlyTest()
        {
            var videoPort = new VideoPort
            {
                Name = "VGA"
            };
            var sut = new Gadget("Model", new []{videoPort});

            var copy = sut.Clone();

            Assert.AreEqual(sut.GetModel(), copy.GetModel());
            Assert.AreEqual(sut.Serial, copy.Serial);
            Assert.AreEqual(sut.Title, copy.Title);

            Assert.AreNotSame(sut.VideoPorts, copy.VideoPorts);
        }
コード例 #3
0
ファイル: GadgetTests.cs プロジェクト: matry-ny/brain
        public void TestVideoPorts()
        {
            string title = "Samsung";
            string model = "Galaxy S5";

            var port1 = new VideoPort {Name = "VGA"};
            var port2 = new VideoPort {Name = "HDMI"};
            var port3 = new VideoPort {Name = "DVI"};

            Gadget testGadget = new Gadget(model, new[] {port1, port2, port3});

            Assert.AreEqual(testGadget.VideoPorts.Count, 3);
            Assert.AreEqual(testGadget.VideoPorts[0], port1);
            Assert.AreEqual(testGadget.VideoPorts[1], port2);
            Assert.AreEqual(testGadget.VideoPorts[2], port3);
        }
コード例 #4
0
ファイル: Gadget.cs プロジェクト: matry-ny/brain
 /// <summary>
 /// More customized constructor
 /// </summary>
 /// <param name="model"></param>
 /// <param name="videoPorts"></param>
 public Gadget(string model, VideoPort[] videoPorts, string serial = "000-00-00")
 {
     _videoPorts = new VideoPortsCollection(videoPorts);
     _model = model;
     _serial = serial;
 }
コード例 #5
0
 public VideoPortsCollection(VideoPort[] videoPorts)
 {
     _videoPorts = videoPorts;
 }