This commit is contained in:
Ivan Hörler 2018-07-17 19:51:33 +02:00
parent 52df5d3a90
commit 9ec488b15a
62 changed files with 678 additions and 92 deletions

View File

@ -55,6 +55,9 @@
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />
@ -80,55 +83,57 @@
<Generator>EntityModelCodeGenerator</Generator>
<LastGenOutput>Model.Designer.cs</LastGenOutput>
</EntityDeploy>
<Content Include="alchemy\alchemy-white.css" />
<Content Include="alchemy\alchemy.css" />
<Content Include="alchemy\alchemy.js" />
<Content Include="alchemy\alchemy.min.css" />
<Content Include="alchemy\alchemy.min.js" />
<Content Include="alchemy\scripts\vendor.js" />
<Content Include="alchemy\styles\fonts\fontawesome-webfont.svg" />
<Content Include="alchemy\styles\images\maze-black.png" />
<Content Include="alchemy\styles\vendor.css" />
<Content Include="bootstrap\css\bootstrap-grid.css" />
<Content Include="bootstrap\css\bootstrap-grid.min.css" />
<Content Include="bootstrap\css\bootstrap-reboot.css" />
<Content Include="bootstrap\css\bootstrap-reboot.min.css" />
<Content Include="bootstrap\css\bootstrap.css" />
<Content Include="bootstrap\css\bootstrap.min.css" />
<Content Include="bootstrap\js\bootstrap.bundle.js" />
<Content Include="bootstrap\js\bootstrap.bundle.min.js" />
<Content Include="bootstrap\js\bootstrap.js" />
<Content Include="bootstrap\js\bootstrap.min.js" />
<Content Include="cluster_dependencies\alchemy\alchemy-white.css" />
<Content Include="cluster_dependencies\alchemy\alchemy.css" />
<Content Include="cluster_dependencies\alchemy\alchemy.js" />
<Content Include="cluster_dependencies\alchemy\alchemy.min.css" />
<Content Include="cluster_dependencies\alchemy\alchemy.min.js" />
<Content Include="cluster_dependencies\alchemy\scripts\vendor.js" />
<Content Include="cluster_dependencies\alchemy\styles\fonts\fontawesome-webfont.svg" />
<Content Include="cluster_dependencies\alchemy\styles\images\maze-black.png" />
<Content Include="cluster_dependencies\alchemy\styles\vendor.css" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap-grid.css" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap-grid.min.css" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap-reboot.css" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap-reboot.min.css" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap.css" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap.min.css" />
<Content Include="cluster_dependencies\bootstrap\js\bootstrap.bundle.js" />
<Content Include="cluster_dependencies\bootstrap\js\bootstrap.bundle.min.js" />
<Content Include="cluster_dependencies\bootstrap\js\bootstrap.js" />
<Content Include="cluster_dependencies\bootstrap\js\bootstrap.min.js" />
<Content Include="cluster.aspx" />
<Content Include="d3\d3.js" />
<Content Include="d3\d3.min.js" />
<Content Include="cluster_dependencies\d3\d3.js" />
<Content Include="cluster_dependencies\d3\d3.min.js" />
<Content Include="Global.asax" />
<Content Include="jquery\jquery-3.3.1.min.js" />
<Content Include="lodash\lodash.js" />
<Content Include="cluster_dependencies\jquery\jquery-3.3.1.min.js" />
<Content Include="cluster_dependencies\lodash\lodash.js" />
<Content Include="Model.edmx.diagram">
<DependentUpon>Model.edmx</DependentUpon>
</Content>
<Content Include="d3\API.md" />
<Content Include="d3\CHANGES.md" />
<Content Include="d3\LICENSE" />
<Content Include="d3\README.md" />
<Content Include="alchemy\testdata\actors.json" />
<Content Include="alchemy\testdata\charlize.json" />
<Content Include="alchemy\testdata\presocratics.json" />
<Content Include="alchemy\styles\fonts\fontawesome-webfont.eot" />
<Content Include="alchemy\styles\fonts\fontawesome-webfont.ttf" />
<Content Include="alchemy\styles\fonts\fontawesome-webfont.woff" />
<Content Include="alchemy\styles\fonts\FontAwesome.otf" />
<Content Include="bootstrap\js\bootstrap.bundle.js.map" />
<Content Include="bootstrap\js\bootstrap.bundle.min.js.map" />
<Content Include="bootstrap\js\bootstrap.js.map" />
<Content Include="bootstrap\js\bootstrap.min.js.map" />
<Content Include="bootstrap\css\bootstrap-grid.css.map" />
<Content Include="bootstrap\css\bootstrap-grid.min.css.map" />
<Content Include="bootstrap\css\bootstrap-reboot.css.map" />
<Content Include="bootstrap\css\bootstrap-reboot.min.css.map" />
<Content Include="bootstrap\css\bootstrap.css.map" />
<Content Include="bootstrap\css\bootstrap.min.css.map" />
<Content Include="cluster_dependencies\d3\API.md" />
<Content Include="cluster_dependencies\d3\CHANGES.md" />
<Content Include="cluster_dependencies\d3\LICENSE" />
<Content Include="cluster_dependencies\d3\README.md" />
<Content Include="cluster_dependencies\alchemy\testdata\actors.json" />
<Content Include="cluster_dependencies\alchemy\testdata\charlize.json" />
<Content Include="cluster_dependencies\alchemy\testdata\presocratics.json" />
<Content Include="cluster_dependencies\alchemy\styles\fonts\fontawesome-webfont.eot" />
<Content Include="cluster_dependencies\alchemy\styles\fonts\fontawesome-webfont.ttf" />
<Content Include="cluster_dependencies\alchemy\styles\fonts\fontawesome-webfont.woff" />
<Content Include="cluster_dependencies\alchemy\styles\fonts\FontAwesome.otf" />
<Content Include="cluster_dependencies\bootstrap\js\bootstrap.bundle.js.map" />
<Content Include="cluster_dependencies\bootstrap\js\bootstrap.bundle.min.js.map" />
<Content Include="cluster_dependencies\bootstrap\js\bootstrap.js.map" />
<Content Include="cluster_dependencies\bootstrap\js\bootstrap.min.js.map" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap-grid.css.map" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap-grid.min.css.map" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap-reboot.css.map" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap-reboot.min.css.map" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap.css.map" />
<Content Include="cluster_dependencies\bootstrap\css\bootstrap.min.css.map" />
<Content Include="cluster_dependencies\alchemy\testdata\contrib.json" />
<Content Include="cluster_dependencies\Blueprint.json" />
<None Include="packages.config" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
@ -159,6 +164,11 @@
<Compile Include="cluster.aspx.designer.cs">
<DependentUpon>cluster.aspx</DependentUpon>
</Compile>
<Compile Include="cluster_dependencies\ClusterConverter.cs" />
<Compile Include="cluster_dependencies\JsonConverter.cs" />
<Compile Include="cluster_dependencies\JsonModel.cs" />
<Compile Include="cluster_dependencies\Models\ClusterPatient.cs" />
<Compile Include="cluster_dependencies\Models\ClusterResult.cs" />
<Compile Include="DatabaseAccess\Doctor.cs" />
<Compile Include="DatabaseAccess\Origin.cs" />
<Compile Include="DatabaseAccess\Origin_Exam.cs" />
@ -176,6 +186,7 @@
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Global.cs" />
<Compile Include="IService.cs" />
<Compile Include="Model.Context.cs">
<AutoGen>True</AutoGen>

View File

@ -8,7 +8,7 @@ using EHEC_Server.DataBuilder;
namespace EHEC_Server
{
public class Global : System.Web.HttpApplication
public partial class Global : System.Web.HttpApplication
{
private static List<string> FirstNames = new List<string>(new string[]
{
@ -49,8 +49,8 @@ namespace EHEC_Server
protected void Application_Start(object sender, EventArgs e)
{
//add patients
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{
//using (EHEC_DBEntities ctx = new EHEC_DBEntities())
//{
Random p = new Random();
for (int i = 0; i < 10; i++)
@ -64,28 +64,30 @@ namespace EHEC_Server
City = Cities[p.Next(0, 7)].ToString(),
Region = Regions[p.Next(0, 6)].ToString()
};
ctx.Patients.Add(patient);
ctx.SaveChanges();
Global.GlobalInstance.DbAccess.Patients.Add(patient);
//ctx.Patients.Add(patient);
//ctx.SaveChanges();
}
}
//}
//add doctors
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{
//using (EHEC_DBEntities ctx = new EHEC_DBEntities())
//{
Random p = new Random();
Random d = new Random();
for (int i = 0; i < 10; i++)
{
Doctor doctor = new Doctor
{
FirstName = FirstNames[p.Next(0, 5)].ToString(),
LastName = LastNames[p.Next(0, 7)].ToString(),
DoctorOrigin = DoctorOrigins[p.Next(0, 4)].ToString(),
Region = Regions[p.Next(0, 6)].ToString()
FirstName = FirstNames[d.Next(0, 5)].ToString(),
LastName = LastNames[d.Next(0, 7)].ToString(),
DoctorOrigin = DoctorOrigins[d.Next(0, 4)].ToString(),
Region = Regions[d.Next(0, 6)].ToString()
};
ctx.Doctors.Add(doctor);
ctx.SaveChanges();
Global.GlobalInstance.DbAccess.Doctors.Add(doctor);
//ctx.Doctors.Add(doctor);
//ctx.SaveChanges();
}
}
//}
}
@ -119,5 +121,7 @@ namespace EHEC_Server
{
}
}
}

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace EHEC_Server
{
/// <summary>
/// This is a Singleton implementation for the need of one single db connection
/// </summary>
public partial class Global
{
private static Global globalInstance = null;
private static EHEC_DBEntities dbAccess = null;
public static Global GlobalInstance {
get {
if (globalInstance == null)
{
globalInstance = new Global();
}
return globalInstance;
}
}
public EHEC_DBEntities DbAccess
{
get {
if (dbAccess == null)
{
dbAccess = new EHEC_DBEntities();
}
return dbAccess;
}
}
}
}

View File

@ -8,8 +8,10 @@ using EHEC_Server.DataBuilder;
namespace EHEC_Server
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Service.svc or Service.svc.cs at the Solution Explorer and start debugging.
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the
// class name "Service" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select
// Service.svc or Service.svc.cs at the Solution Explorer and start debugging.
public class Service : IService
{
@ -19,7 +21,7 @@ namespace EHEC_Server
Origin dataaccess_origin = new Origin();
Origin_Exam dataaccess_origin_exam = new Origin_Exam();
Exam dataaccess_exam = new Exam();
private readonly string ping = "pong";
public List<Doctor> GetDoctors()
{
@ -63,6 +65,7 @@ namespace EHEC_Server
return dataaccess_result.CreateResult(result);
}
private readonly string ping = "pong";
public string Ping()
{
return ping;

View File

@ -7,17 +7,17 @@
<title>CS-EHEC-II</title>
<%--<script src="https://d3js.org/d3.v4.min.js"></script>--%>
<%--<script src="http://cdn.graphalchemist.com/alchemy.min.js"></script>--%>
<link rel="stylesheet" type="text/css" href="alchemy/alchemy.css" />
<link rel="stylesheet" type="text/css" href="alchemy/styles/vendor.css" />
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css" />
<script type="text/javascript" src="jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="lodash/lodash.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.bundle.js"></script>
<%--<script type="text/javascript" src="d3/d3.min.js"></script>--%>
<script type="text/javascript" src="d3/d3.js"></script>
<script type="text/javascript" src="alchemy/alchemy.js"></script>
<%--<script type="text/javascript" src="alchemy/alchemy.min.js"></script>--%>
<script type="text/javascript" src="alchemy/scripts/vendor.js"></script>
<link rel="stylesheet" type="text/css" href="cluster_dependencies/alchemy/alchemy.css" />
<link rel="stylesheet" type="text/css" href="cluster_dependencies/alchemy/styles/vendor.css" />
<link rel="stylesheet" type="text/css" href="cluster_dependencies/bootstrap/css/bootstrap.css" />
<script type="text/javascript" src="cluster_dependencies/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="cluster_dependencies/lodash/lodash.js"></script>
<script type="text/javascript" src="cluster_dependencies/bootstrap/js/bootstrap.bundle.js"></script>
<%--<script type="text/javascript" src="cluster_dependencies/d3/d3.min.js"></script>--%>
<script type="text/javascript" src="cluster_dependencies/d3/d3.js"></script>
<script type="text/javascript" src="cluster_dependencies/alchemy/alchemy.js"></script>
<%--<script type="text/javascript" src="cluster_dependencies/alchemy/alchemy.min.js"></script>--%>
<script type="text/javascript" src="cluster_dependencies/alchemy/scripts/vendor.js"></script>
</head>
<body>
@ -29,24 +29,25 @@
<div class="alchemy" id="alchemy"></div>
<script type="text/javascript">
var config = {
dataSource: "alchemy/testdata/presocratics.json",
cluster: true,
clusterColours: ["#DD79FF", "#00FF30", "#5168FF", "#f83f00", "#ff8d8f"],
forceLocked: false,
nodeCaption: "title",
edgeCaption: "relatedness",
nodeCaptionsOnByDefault: true,
nodeTypes: {"type":["philosopher"]},
directedEdges:true,
nodeStyle: {
"philosopher": {
"radius": 15
}
},
initialScale: 0.5,
initialTranslate: [250,150]
}
var config = {
dataSource: 'cluster_dependencies/alchemy/testdata/contrib.json',
forceLocked: true,
graphHeight: function(){ return 800; },
graphWidth: function(){ return 800; },
linkDistance: function(){ return 50; },
nodeTypes: {
"node_type": [
"Maintainer",
"Contributor",
"none"
]
},
nodeMouseOver: 'fun_fact',
//nodeCaption: function(node){
// return node.caption + " _ " + node.fun_fact;
//}
};
alchemy = new Alchemy(config)
</script>

View File

@ -0,0 +1,32 @@
{
"comment": "EHEC Casestudy for TI6-IBZ-AR",
"nodes": [
{
"id": 1,
"nodetype": "person",
"name": "name"
},
{
"id": 2,
"nodetype": "result",
"name": "bakterie"
},
{
"id": 3,
"nodetype": "origin",
"name": "ort"
}
],
"edges": [
{
"source": 1,
"target": 2,
"edgetype": "angesteckt mit "
},
{
"source": 1,
"target": 3,
"edgetype": "angesteckt in "
}
]
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EHEC_Server;
namespace EHEC_Server
{
public class ClusterConverter
{
public void WriteJson()
{
var json = JsonConverter.Serialize(GetCompanyObject());
System.IO.File.WriteAllText(@"C:\Users\Public\Documents\Company.json", json);
}
private List<ClusterPatient> GetClusterPatient()
{
return new List<ClusterPatient>();
}
}
}

View File

@ -0,0 +1,140 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using EHEC_Server;
namespace EHEC_Server
{
/// <summary>
/// Class to convert object into json
/// </summary>
public class JsonConverter
{ // https://www.c-sharpcorner.com/article/object-to-json-converter/
/// <summary>
/// To Serialize a object
/// </summary>
/// <param name="obj">object for serialization</param>
/// <returns>json string of object</returns>
public static string Serialize(object obj)
{
///// To parse base class object
var json = ParsePreDefinedClassObject(obj);
///// Null means it is not a base class object
if (!string.IsNullOrEmpty(json))
{
return json;
}
//// For parsing user defined class object
//// To get all properties of object
//// and then store object properties and their value in dictionary container
var objectDataContainer = obj.GetType().GetProperties().ToDictionary(i => i.Name, i => i.GetValue(obj));
StringBuilder jsonfile = new StringBuilder();
jsonfile.Append("{");
foreach (var data in objectDataContainer)
{
jsonfile.Append($"\"{data.Key}\":{Serialize(data.Value)},");
}
//// To remove last comma
jsonfile.Remove(jsonfile.Length - 1, 1);
jsonfile.Append("}");
return jsonfile.ToString();
}
/// <summary>
/// To Serialize C# Pre defined classes
/// </summary>
/// <param name="obj">object for serialization</param>
/// <returns>json string of object</returns>
private static string ParsePreDefinedClassObject(object obj)
{
if (obj is null)
{
return "null";
}
if (IsJsonValueType(obj))
{
return obj.ToString().ToLower();
}
else if (IsJsonStringType(obj))
{
return $"\"{obj.ToString()}\"";
}
else if (obj is IDictionary)
{
return SearlizeDictionaryObject((IDictionary)obj);
}
else if (obj is IList || obj is Array)
{
return SearlizeListObject((IEnumerable)obj);
}
return null;
}
/// <summary>
/// To Serialize Dictionary type object
/// </summary>
/// <param name="obj">object for serialization</param>
/// <returns>json string of object</returns>
private static string SearlizeDictionaryObject(IDictionary dict)
{
StringBuilder jsonfile = new StringBuilder();
jsonfile.Append("{");
var keysAsJson = new List<string>();
var valuesAsJson = new List<string>();
foreach (var item in (IEnumerable)dict.Keys)
{
keysAsJson.Add(Serialize(item));
}
foreach (var item in (IEnumerable)dict.Values)
{
valuesAsJson.Add(Serialize(item));
}
for (int i = 0; i < dict.Count; i++)
{
////To check whether data is under double quotes or not
keysAsJson[i] = keysAsJson[i].Contains("\"") ? keysAsJson[i] : $"\"{keysAsJson[i]}\"";
jsonfile.Append($"{keysAsJson[i]}:{valuesAsJson[i]},");
}
jsonfile.Remove(jsonfile.Length - 1, 1);
jsonfile.Append("}");
return jsonfile.ToString();
}
/// <summary>
/// To Serialize Enumerable (IList,Array..etc) type object
/// </summary>
/// <param name="obj">object for serialization</param>
/// <returns>json string of object</returns>
private static string SearlizeListObject(IEnumerable obj)
{
StringBuilder jsonfile = new StringBuilder();
jsonfile.Append("[");
foreach (var item in obj)
{
jsonfile.Append($"{Serialize(item)},");
}
jsonfile.Remove(jsonfile.Length - 1, 1);
jsonfile.Append("]");
return jsonfile.ToString();
}
private static bool IsJsonStringType(object obj)
{
return obj is string || obj is DateTime;
}
private static bool IsJsonValueType(object obj)
{
return obj.GetType().IsPrimitive;
}
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Newtonsoft.Json;
namespace EHEC_Server
{
public class JsonModel
{
public IList<JsonNodeModel> Node { get; set; } = new List<JsonNodeModel>();
public IList<JsonEdgesModel> Edge { get; set; } = new List<JsonEdgesModel>();
}
public class JsonNodeModel
{
public int Id { get; set; }
public string Nodetype { get; set; }
public string Name { get; set; }
}
public class JsonEdgesModel
{
public int Source { get; set; }
public int Target { get; set; }
public string EdgeType { get; set; }
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace EHEC_Server
{
public class ClusterPatient
{
public List<Patient> Patients;
public List<ClusterPatient> ClusterPatients;
public int Id;
public string Name;
public List<ClusterPatient> GetPatients()
{
Patients = Global.GlobalInstance.DbAccess.Patients.ToList();
foreach (Patient element in Patients)
{
ClusterPatient clusterPatient = new ClusterPatient
{
Id = element.PatientId,
Name = element.FirstName + " " + element.LastName
};
ClusterPatients.Add(clusterPatient);
}
return ClusterPatients;
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace EHEC_Server
{
public class ClusterResult
{
public List<Result> result = new List<Result>();
public int Id { get; set; }
public string Name { get; set; }
public ClusterResult() { }
public ClusterResult(int id, string name)
{
Id = id;
Name = name;
}
}
}

View File

@ -0,0 +1,88 @@
{
"comment": "AlchemyJS contributors",
"nodes": [
{
"id": 0,
"caption": "AlchemyJS",
"role": "project",
"fun_fact": "built almost entirely in D3",
"root": true
},
{
"id": 1,
"caption": "Huston Hedinger",
"github": "hustonhedinger",
"role": "Maintainer",
"fun_fact": "hooligan"
},
{
"id": 2,
"caption": "Grace Andrews",
"github": "Grace-Andrews",
"role": "Maintainer",
"fun_fact": "was born left handed, now right handed."
},
{
"id": 3,
"caption": "Isabella Jorissen",
"github": "ifjorissen",
"role": "Maintainer",
"fun_fact": "knows a lot of digits of pi. Also loves pie."
},
{
"id": 4,
"caption": "Matt Cox",
"github": "MDCox",
"role": "Maintainer",
"fun_fact": "is not fun"
},
{
"id": 5,
"caption": "Dave Torbeck",
"github": "DaveTorbeck",
"role": "Contributor",
"fun_fact": ""
},
{
"id": 6,
"caption": "Ivan Hörler",
"github": "novski",
"role": "none",
"fun_fact": "does code...",
"additional_property": "one two thre, hwo pwo!"
}
],
"edges": [
{
"source": 1,
"target": 0,
"caption": "Maintains"
},
{
"source": 2,
"target": 1,
"caption": "Maintains"
},
{
"source": 3,
"target": 0,
"caption": "Maintains"
},
{
"source": 4,
"target": 0,
"caption": "Often Breaks"
},
{
"source": 5,
"target": 0,
"caption": "contributes"
},
{
"source": 6,
"target": 0,
"caption": "does nothing"
}
]
}

View File

@ -3,4 +3,5 @@
<package id="EntityFramework" version="6.1.3" targetFramework="net461" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.8" targetFramework="net461" />
<package id="Microsoft.Net.Compilers" version="2.4.0" targetFramework="net461" developmentDependency="true" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
</packages>

View File

@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("UnitTestProject1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTestProject1")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("fa6173e8-f454-4582-aa0d-dee40126cae3")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using JsonConverterTest;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace JsonConverterTest
{
[TestClass]
public class UnitTest1
{
/// <summary>
/// To Get a instance of object Company
/// </summary>
/// <returns>instance of company</returns>
private Comapany GetCompanyObject()
{
return new Comapany
{
Name = "CSG Solutions India Pvt Ltd",
TotalEmployee = 50,
Established = DateTime.Now,
IsGovtOrganisation = false,
TotalAsset = 20000000,
Branches = new List<Branch>
{
new Branch
{
Country = "India",
State = "Karnataka",
Address = new Location
{
BuildingName = "Sri Hari Tower",
Street = "2nd Main Road",
ZipCode = 560016
}
},
new Branch
{
Country = "USA",
State = "Germantown",
Address = new Location
{
BuildingName = "Zinc Tower",
Street = "Germantown Road",
ZipCode = 50001
}
}
},
Departments = new Dictionary<string, Department>
{
{ "Engineering", new Department { DeptId = 001, DeptName = "Super Engineers" } },
{ "Support", new Department { DeptId = 002, DeptName = "24*7 Tech Support" } },
{ "Marketings", new Department { DeptId = 003, DeptName = "Tech Mavens" } }
},
Management = new Management { CEO = "Tarun Kumar Rajak", Founder = "Ashok Kisku" }
};
}
/// <summary>
/// To Test Serialize functionality
/// </summary>
[TestMethod]
public void TestMethod1()
{
var json = JsonConverter.Serialize(GetCompanyObject());
System.IO.File.WriteAllText(@"C:\Users\Public\Documents\Company.json", json);
}
}
}

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FA6173E8-F454-4582-AA0D-DEE40126CAE3}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTestProject1</RootNamespace>
<AssemblyName>UnitTestProject1</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.2.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.2.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="UnitTest1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets')" />
</Project>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="1.2.1" targetFramework="net462" />
<package id="MSTest.TestFramework" version="1.2.1" targetFramework="net462" />
</packages>

Binary file not shown.