public void GetVertexes_From_File_Test()
        {
            var service = new CsvGraphDataService();
            bool callSuccess = false;
            bool callFail = false;

            service.GetVertexes((data) => { callSuccess = true; }, (e) => { callFail = true; });

            Assert.IsFalse(callFail);
            Assert.IsTrue(callSuccess);
        }
Exemple #2
0
        public void GetVertexes_From_File_Test()
        {
            var  service     = new CsvGraphDataService();
            bool callSuccess = false;
            bool callFail    = false;

            service.GetVertexes((data) => { callSuccess = true; }, (e) => { callFail = true; });

            Assert.IsFalse(callFail);
            Assert.IsTrue(callSuccess);
        }
Exemple #3
0
        public void UpdateVertex_Test()
        {
            //below are data tobe tested

            //ID,Property,Value
            //11,First Name,ABC11
            //11,Last Name,XYZ11
            //11,Age,13
            //12,First Name,ABC12
            //12,Last Name,XYZ12
            //12,Age,34
            //12,First Name1,ABC12
            //12,Last Name1,XYZ12
            //12,Age1,34
            //12,First Name2,ABC12
            //12,Last Name2,XYZ12
            //12,Age2,34

            var  service     = new CsvGraphDataService();
            bool callSuccess = false;
            bool callFail    = false;
            IEnumerable <DataVertex> resultList = null;

            service.GetVertexes((data) => { callSuccess = true; resultList = data; }, (e) => { callFail = true; });

            Assert.IsNotNull(resultList);
            Assert.IsFalse(callFail);
            Assert.IsTrue(callSuccess);

            var item1 = resultList.FirstOrDefault();

            var list = new ObservableCollection <Model.PropertyViewmodel>();

            item1.Properties = list;

            list.Add(new Model.PropertyViewmodel(1, "First Name", "Payton", item1));
            list.Add(new Model.PropertyViewmodel(2, "Last Name", "Li", item1));
            list.Add(new Model.PropertyViewmodel(3, "Age", "29", item1));

            service.UpdateVertex(item1, (r, data, error) =>
            {
                Assert.IsTrue(r);
                Assert.AreEqual(item1, data);
            });
        }
Exemple #4
0
        public void UpdateVertexes_Test()
        {
            var       service     = new CsvGraphDataService();
            bool      callSuccess = false;
            Exception er;
            ObservableCollection <DataVertex> list = new ObservableCollection <DataVertex>();
            var item1 = new DataVertex(1);
            var listV = new ObservableCollection <Model.PropertyViewmodel>();

            item1.Properties = listV;

            listV.Add(new Model.PropertyViewmodel(1, "First Name", "Payton", item1));
            listV.Add(new Model.PropertyViewmodel(2, "Last Name", "Li", item1));
            listV.Add(new Model.PropertyViewmodel(3, "Age", "29", item1));

            list.Add(item1);

            service.UpdateVertexes(list, (sucess, error) =>
            {
                er          = error;
                callSuccess = sucess;
            });

            DataVertex item1FromSource = null;

            service.GetVertexes((data) =>
            {
                item1FromSource = data.FirstOrDefault();

                callSuccess = true;
            }, (e) => { });

            Assert.IsTrue(callSuccess);
            Assert.IsNotNull(item1FromSource);
            Assert.AreEqual(item1.Id, item1FromSource.Id);
        }
        public void UpdateVertex_Test()
        {

            //below are data tobe tested

            //ID,Property,Value
            //11,First Name,ABC11
            //11,Last Name,XYZ11
            //11,Age,13
            //12,First Name,ABC12
            //12,Last Name,XYZ12
            //12,Age,34
            //12,First Name1,ABC12
            //12,Last Name1,XYZ12
            //12,Age1,34
            //12,First Name2,ABC12
            //12,Last Name2,XYZ12
            //12,Age2,34

            var service = new CsvGraphDataService();
            bool callSuccess = false;
            bool callFail = false;
            IEnumerable<DataVertex> resultList = null;
            service.GetVertexes((data) => { callSuccess = true; resultList = data; }, (e) => { callFail = true; });

            Assert.IsNotNull(resultList);
            Assert.IsFalse(callFail);
            Assert.IsTrue(callSuccess);

            var item1 = resultList.FirstOrDefault();

            var list = new ObservableCollection<Model.PropertyViewmodel>();
            item1.Properties = list;

            list.Add(new Model.PropertyViewmodel(1,"First Name", "Payton", item1));
            list.Add(new Model.PropertyViewmodel(2,"Last Name", "Li", item1));
            list.Add(new Model.PropertyViewmodel(3,"Age", "29", item1));

            service.UpdateVertex(item1, (r,data, error) =>
            {
                Assert.IsTrue(r);
                Assert.AreEqual(item1, data);
            });
        }
        public void UpdateVertexes_Test()
        {
            var service = new CsvGraphDataService();
            bool callSuccess = false;
            Exception er;
            ObservableCollection<DataVertex> list = new ObservableCollection<DataVertex>();
            var item1 = new DataVertex(1);
            var listV = new ObservableCollection<Model.PropertyViewmodel>();
            item1.Properties = listV;

            listV.Add(new Model.PropertyViewmodel(1,"First Name", "Payton", item1));
            listV.Add(new Model.PropertyViewmodel(2,"Last Name", "Li", item1));
            listV.Add(new Model.PropertyViewmodel(3,"Age", "29", item1));

            list.Add(item1);

            service.UpdateVertexes(list, (sucess, error) =>
            {
                er = error;
                callSuccess = sucess;
            });

            DataVertex item1FromSource = null;
            service.GetVertexes((data) =>
            {
                item1FromSource = data.FirstOrDefault();

                callSuccess = true;

            }, (e) => { });

            Assert.IsTrue(callSuccess);
            Assert.IsNotNull(item1FromSource);
            Assert.AreEqual(item1.Id, item1FromSource.Id);
        }