-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): use pascal case for generated c# code (#21)
Signed-off-by: Simon Stone <[email protected]> Signed-off-by: Simon Stone <[email protected]>
- Loading branch information
Simon Stone
authored
Sep 14, 2022
1 parent
e18d991
commit d5a2dad
Showing
6 changed files
with
496 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,12 +38,12 @@ public void SimpleObject_Succeeds() | |
|
||
employee.ShouldEqual(new Employee() | ||
{ | ||
firstName = "Matt", | ||
lastName = "Roberts", | ||
email = "[email protected]", | ||
_identifier = "[email protected]", | ||
department = Department.ENGINEERING, | ||
employeeId = "123" | ||
FirstName = "Matt", | ||
LastName = "Roberts", | ||
Email = "[email protected]", | ||
_Identifier = "[email protected]", | ||
Department = Department.ENGINEERING, | ||
EmployeeId = "123" | ||
}); | ||
} | ||
|
||
|
@@ -66,13 +66,13 @@ public void SimpleObject_DeserializeToSuperType_Succeeds() | |
|
||
employee.ToExpectedObject().ShouldEqual(new Manager() | ||
{ | ||
firstName = "Matt", | ||
lastName = "Roberts", | ||
email = "[email protected]", | ||
_identifier = "[email protected]", | ||
department = Department.ENGINEERING, | ||
employeeId = "123", | ||
budget = 1 | ||
FirstName = "Matt", | ||
LastName = "Roberts", | ||
Email = "[email protected]", | ||
_Identifier = "[email protected]", | ||
Department = Department.ENGINEERING, | ||
EmployeeId = "123", | ||
Budget = 1 | ||
}); | ||
|
||
// Should not throw | ||
|
@@ -144,18 +144,18 @@ public void PolymorphicObject_Succeeds() | |
|
||
employee.ShouldEqual(new Employee() | ||
{ | ||
firstName = "Matt", | ||
lastName = "Roberts", | ||
email = "[email protected]", | ||
_identifier = "[email protected]", | ||
department = Department.ENGINEERING, | ||
employeeId = "123", | ||
manager = new Employee(){ | ||
email = "[email protected]", | ||
_identifier = "[email protected]", | ||
employeeId = "456", | ||
firstName = "Martin", | ||
lastName = "Halford", | ||
FirstName = "Matt", | ||
LastName = "Roberts", | ||
Email = "[email protected]", | ||
_Identifier = "[email protected]", | ||
Department = Department.ENGINEERING, | ||
EmployeeId = "123", | ||
Manager = new Employee(){ | ||
Email = "[email protected]", | ||
_Identifier = "[email protected]", | ||
EmployeeId = "456", | ||
FirstName = "Martin", | ||
LastName = "Halford", | ||
} | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,27 +26,27 @@ public void Roundtrip() | |
{ | ||
var carVIN = new StringProperty() | ||
{ | ||
name = "vin" | ||
Name = "vin" | ||
}; | ||
|
||
var carConcept = new ConceptDeclaration() | ||
{ | ||
name = "Car", | ||
isAbstract = false, | ||
properties = new StringProperty[1] { carVIN } | ||
Name = "Car", | ||
IsAbstract = false, | ||
Properties = new StringProperty[1] { carVIN } | ||
}; | ||
|
||
var carModel = new Model() | ||
{ | ||
_namespace = "org.acme", | ||
declarations = new ConceptDeclaration[1] { carConcept }, | ||
Namespace = "org.acme", | ||
Declarations = new ConceptDeclaration[1] { carConcept }, | ||
}; | ||
|
||
var jsonString = JsonConvert.SerializeObject(carModel); | ||
Model model2 = JsonConvert.DeserializeObject<Model>(jsonString); | ||
ConceptDeclaration car2 = (ConceptDeclaration) model2.declarations[0]; | ||
StringProperty prop = (StringProperty)((ConceptDeclaration)car2).properties[0]; | ||
Assert.Equal(prop._class,"[email protected]"); | ||
ConceptDeclaration car2 = (ConceptDeclaration) model2.Declarations[0]; | ||
StringProperty prop = (StringProperty)((ConceptDeclaration)car2).Properties[0]; | ||
Assert.Equal(prop._Class,"[email protected]"); | ||
} | ||
|
||
[Fact] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,12 +26,12 @@ public void SimpleObject() | |
{ | ||
Employee employee = new Employee() | ||
{ | ||
firstName = "Matt", | ||
lastName = "Roberts", | ||
email = "[email protected]", | ||
_identifier = "[email protected]", | ||
department = Department.ENGINEERING, | ||
employeeId = "123" | ||
FirstName = "Matt", | ||
LastName = "Roberts", | ||
Email = "[email protected]", | ||
_Identifier = "[email protected]", | ||
Department = Department.ENGINEERING, | ||
EmployeeId = "123" | ||
}; | ||
|
||
string jsonString = JsonConvert.SerializeObject(employee); | ||
|
@@ -53,17 +53,17 @@ public void ComplexObject() | |
{ | ||
Employee employee = new Employee() | ||
{ | ||
firstName = "Matt", | ||
lastName = "Roberts", | ||
email = "[email protected]", | ||
_identifier = "[email protected]", | ||
department = Department.ENGINEERING, | ||
employeeId = "123", | ||
manager = new Employee(){ | ||
email = "[email protected]", | ||
employeeId = "456", | ||
firstName = "Martin", | ||
lastName = "Halford", | ||
FirstName = "Matt", | ||
LastName = "Roberts", | ||
Email = "[email protected]", | ||
_Identifier = "[email protected]", | ||
Department = Department.ENGINEERING, | ||
EmployeeId = "123", | ||
Manager = new Employee(){ | ||
Email = "[email protected]", | ||
EmployeeId = "456", | ||
FirstName = "Martin", | ||
LastName = "Halford", | ||
} | ||
}; | ||
|
||
|
@@ -94,18 +94,18 @@ public void PolymorphicObject() | |
{ | ||
Employee employee = new Employee() | ||
{ | ||
firstName = "Matt", | ||
lastName = "Roberts", | ||
email = "[email protected]", | ||
_identifier = "[email protected]", | ||
department = Department.ENGINEERING, | ||
employeeId = "123", | ||
manager = new Manager(){ | ||
email = "[email protected]", | ||
employeeId = "456", | ||
firstName = "Martin", | ||
lastName = "Halford", | ||
budget = 500000 | ||
FirstName = "Matt", | ||
LastName = "Roberts", | ||
Email = "[email protected]", | ||
_Identifier = "[email protected]", | ||
Department = Department.ENGINEERING, | ||
EmployeeId = "123", | ||
Manager = new Manager(){ | ||
Email = "[email protected]", | ||
EmployeeId = "456", | ||
FirstName = "Martin", | ||
LastName = "Halford", | ||
Budget = 500000 | ||
} | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,39 +12,44 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
namespace AccordProject.Concerto.Tests { | ||
using AccordProject.Concerto; | ||
[AccordProject.Concerto.Type(Namespace = "org.accordproject.concerto.test", Version = "1.2.3", Name = "Person")] | ||
[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] | ||
public abstract class Person : Participant { | ||
[Newtonsoft.Json.JsonProperty("$class")] | ||
public override string _class { get; } = "[email protected]"; | ||
public string email { get; set; } | ||
public string firstName { get; set; } | ||
public string lastName { get; set; } | ||
} | ||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] | ||
public enum Department { | ||
namespace AccordProject.Concerto.Tests; | ||
using AccordProject.Concerto; | ||
[AccordProject.Concerto.Type(Namespace = "org.accordproject.concerto.test", Version = "1.2.3", Name = "Person")] | ||
[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] | ||
public abstract class Person : Participant { | ||
[Newtonsoft.Json.JsonProperty("$class")] | ||
public override string _Class { get; } = "[email protected]"; | ||
[Newtonsoft.Json.JsonProperty("email")] | ||
public string Email { get; set; } | ||
[Newtonsoft.Json.JsonProperty("firstName")] | ||
public string FirstName { get; set; } | ||
[Newtonsoft.Json.JsonProperty("lastName")] | ||
public string LastName { get; set; } | ||
} | ||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] | ||
public enum Department { | ||
MARKETING, | ||
SALES, | ||
ENGINEERING, | ||
OPERATIONS, | ||
} | ||
|
||
[AccordProject.Concerto.Type(Namespace = "org.accordproject.concerto.test", Version = "1.2.3", Name = "Employee")] | ||
[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] | ||
public class Employee : Person { | ||
[Newtonsoft.Json.JsonProperty("$class")] | ||
public override string _class { get; } = "[email protected]"; | ||
public Department? department { get; set; } | ||
public Employee manager { get; set; } | ||
public string employeeId { get; set; } | ||
} | ||
[AccordProject.Concerto.Type(Namespace = "org.accordproject.concerto.test", Version = "1.2.3", Name = "Manager")] | ||
[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] | ||
public class Manager : Employee { | ||
[Newtonsoft.Json.JsonProperty("$class")] | ||
public override string _class { get; } = "[email protected]"; | ||
public float budget { get; set; } | ||
} | ||
} | ||
[AccordProject.Concerto.Type(Namespace = "org.accordproject.concerto.test", Version = "1.2.3", Name = "Employee")] | ||
[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] | ||
public class Employee : Person { | ||
[Newtonsoft.Json.JsonProperty("$class")] | ||
public override string _Class { get; } = "[email protected]"; | ||
[Newtonsoft.Json.JsonProperty("department")] | ||
public Department? Department { get; set; } | ||
[Newtonsoft.Json.JsonProperty("manager")] | ||
public Employee Manager { get; set; } | ||
[Newtonsoft.Json.JsonProperty("employeeId")] | ||
public string EmployeeId { get; set; } | ||
} | ||
[AccordProject.Concerto.Type(Namespace = "org.accordproject.concerto.test", Version = "1.2.3", Name = "Manager")] | ||
[Newtonsoft.Json.JsonConverter(typeof(AccordProject.Concerto.ConcertoConverterNewtonsoft))] | ||
public class Manager : Employee { | ||
[Newtonsoft.Json.JsonProperty("$class")] | ||
public override string _Class { get; } = "[email protected]"; | ||
[Newtonsoft.Json.JsonProperty("budget")] | ||
public float Budget { get; set; } | ||
} |
Oops, something went wrong.