コード例 #1
0
        public void NameAccessor()
        {
            // Create a new Proxy and use accessors to set the proxy name
               			IProxy proxy = new Proxy("TestProxy");

               			// test assertions
               			Assert.IsTrue(proxy.ProxyName == "TestProxy", "Expecting proxy.ProxyName == 'TestProxy'");
        }
コード例 #2
0
        public void TestDataAccessors()
        {
            // Create a new Proxy and use accessors to set the data
               			IProxy proxy = new Proxy("colors");
            proxy.Data = new List<string>(new[] { "red", "green", "blue" });
            var data = (List<string>) proxy.Data;

               			// test assertions
               			Assert.IsTrue(data.Count == 3, "Expecting data.Count == 3");
               			Assert.IsTrue(data[0] == "red", "Expecting data[0] == 'red'");
               			Assert.IsTrue(data[1] == "green", "Expecting data[1] == 'green'");
               			Assert.IsTrue(data[2] == "blue", "Expecting data[2] == 'blue'");
        }
コード例 #3
0
        public void TestConstructor()
        {
            // Create a new Proxy using the Constructor to set the name and data
            IProxy proxy = new Proxy("colors", new List<string>(new[] { "red", "green", "blue" }));
            var data = (List<string>) proxy.Data;

               			// test assertions
               			Assert.IsNotNull(proxy, "Expecting proxy not null");
               			Assert.IsTrue(proxy.ProxyName == "colors", "Expecting proxy.ProxyName == 'colors'");
            Assert.IsTrue(data.Count == 3, "Expecting data.Count == 3");
            Assert.IsTrue(data[0] == "red", "Expecting data[0] == 'red'");
            Assert.IsTrue(data[1] == "green", "Expecting data[1] == 'green'");
            Assert.IsTrue(data[2] == "blue", "Expecting data[2] == 'blue'");
        }
コード例 #4
0
        public void HasProxy()
        {
            // register a proxy
               			IModel model = Model.Instance;
            string name = "aces" + Thread.CurrentThread.Name;
            IProxy proxy = new Proxy(name, new List<string>(new[] { "clubs", "spades", "hearts", "diamonds" }));
            model.RegisterProxy(proxy);

               			// assert that the model.hasProxy method returns true
               			// for that proxy name
            Assert.IsTrue(model.HasProxy(name), "Expecting model.hasProxy(name) == true");

            // remove the proxy
            model.RemoveProxy(name);

               			// assert that the model.hasProxy method returns false
               			// for that proxy name
            Assert.IsTrue(model.HasProxy(name) == false, "Expecting model.hasProxy(name) == false");
        }