Dispose() public method

Disposes active view models.
public Dispose ( ) : void
return void
Ejemplo n.º 1
0
        public void VMController_OnRequestVM()
        {
            var vmController = new VMController(TestResponse);
             vmController.OnRequestVM("conn1", typeof(UnitTestVM).Name);

             Assert.AreEqual("conn1", _connectionId);
             Assert.AreEqual(typeof(UnitTestVM).Name, _vmId);
             var vmData = JsonConvert.DeserializeObject<UnitTestVM>(_vmData);
             Assert.IsNotNull(vmData);
             Assert.AreEqual("John", vmData.FirstName);
             Assert.AreEqual("Smith", vmData.LastName);
             Assert.AreEqual("John Smith", vmData.FullName);
             Assert.AreEqual(25, vmData.Age);

             vmController.Dispose();
        }
Ejemplo n.º 2
0
        public void VMController_OnUpdateVM()
        {
            var vmController = new VMController(TestResponse);
             vmController.OnRequestVM("conn1", typeof(UnitTestVM).Name);

             vmController.OnUpdateVM("conn1", typeof(UnitTestVM).Name, new Dictionary<string, object>() { { "LastName", "Doe" }, { "Age", 42 } });

             Assert.AreEqual("conn1", _connectionId);
             Assert.AreEqual(typeof(UnitTestVM).Name, _vmId);
             var vmData = (JObject)JsonConvert.DeserializeObject(_vmData);
             Assert.AreEqual("John Doe", vmData["FullName"]);

             vmController.OnRequestVM("conn1", typeof(UnitTestVM).Name);
             Assert.AreEqual("conn1", _connectionId);
             Assert.AreEqual(typeof(UnitTestVM).Name, _vmId);
             vmData = (JObject)JsonConvert.DeserializeObject(_vmData);
             Assert.AreEqual("Doe", vmData["LastName"]);
             Assert.AreEqual(42, vmData["Age"]);

             vmController.Dispose();
        }