Skip to content

Commit

Permalink
Merge pull request #49 from circles-arrows/ran-unit-test-generation-t…
Browse files Browse the repository at this point in the history
…o-apply-fixes

ran unit test generation to apply fixes
  • Loading branch information
circles-arrows committed Feb 26, 2024
2 parents ebaebaf + e9cea40 commit f2640bd
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 58 deletions.
3 changes: 2 additions & 1 deletion Blueprint41.UnitTest/Entities/ACTED_IN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private ACTED_IN(string elementId, Person @in, Movie @out, Dictionary<string, ob
public Person Person { get; private set; }

/// <summary>
/// Restaurant (Out Node)
/// Movie (Out Node)
/// </summary>
public Movie Movie { get; private set; }

Expand Down Expand Up @@ -74,6 +74,7 @@ public static List<ACTED_IN> Where(Func<Alias, QueryCondition[]> expression)
{
var query = Transaction.CompiledQuery
.Match(node.Person.Alias(out var inAlias).In.ACTED_IN.Alias(out var relAlias).Out.Movie.Alias(out var outAlias))

.Where(expression.Invoke(new Alias(relAlias, inAlias, outAlias)))
.Return(relAlias.ElementId.As("elementId"), relAlias.Properties("properties"), inAlias.As("in"), outAlias.As("out"))
.Compile();
Expand Down
12 changes: 10 additions & 2 deletions Blueprint41.UnitTest/Entities/BaseEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ public interface IBaseEntityOriginalData
public partial interface IBaseEntity : OGM
{
string NodeType { get; }

#region Properties
string Uid { get; set; }
System.DateTime LastModifiedOn { get; }

#endregion

#region Relationship Properties
#endregion


IBaseEntityOriginalData OriginalVersion { get; }
}

Expand Down Expand Up @@ -70,8 +78,8 @@ internal IBaseEntityMembers() { }

#region Members for interface IBaseEntity

public Property Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public Property LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
public EntityProperty Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public EntityProperty LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
#endregion

}
Expand Down
12 changes: 6 additions & 6 deletions Blueprint41.UnitTest/Entities/City.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,16 @@ internal CityMembers() { }

#region Members for interface ICity

public Property Name { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["City"].Properties["Name"];
public Property State { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["City"].Properties["State"];
public Property Country { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["City"].Properties["Country"];
public Property Restaurants { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["City"].Properties["Restaurants"];
public EntityProperty Name { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["City"].Properties["Name"];
public EntityProperty State { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["City"].Properties["State"];
public EntityProperty Country { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["City"].Properties["Country"];
public EntityProperty Restaurants { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["City"].Properties["Restaurants"];
#endregion

#region Members for interface IBaseEntity

public Property Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public Property LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
public EntityProperty Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public EntityProperty LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
#endregion

}
Expand Down
5 changes: 3 additions & 2 deletions Blueprint41.UnitTest/Entities/MOVIE_CERTIFICATION.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ private MOVIE_CERTIFICATION(string elementId, Movie @in, Rating @out, Dictionary
internal string _elementId { get; private set; }

/// <summary>
/// Person (In Node)
/// Movie (In Node)
/// </summary>
public Movie Movie { get; private set; }

/// <summary>
/// Restaurant (Out Node)
/// Rating (Out Node)
/// </summary>
public Rating Rating { get; private set; }

Expand Down Expand Up @@ -89,6 +89,7 @@ public static List<MOVIE_CERTIFICATION> Where(Func<Alias, QueryCondition[]> expr
{
var query = Transaction.CompiledQuery
.Match(node.Movie.Alias(out var inAlias).In.MOVIE_CERTIFICATION.Alias(out var relAlias).Out.Rating.Alias(out var outAlias))

.Where(expression.Invoke(new Alias(relAlias, inAlias, outAlias)))
.Return(relAlias.ElementId.As("elementId"), relAlias.Properties("properties"), inAlias.As("in"), outAlias.As("out"))
.Compile();
Expand Down
20 changes: 10 additions & 10 deletions Blueprint41.UnitTest/Entities/Movie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ public void SetDirector(Person person)
{
Dictionary<string, object> properties = new Dictionary<string, object>();

((ILookupHelper<Person>)InnerData.Director).SetItem(person, null, properties);

if (LazySet(Members.Director, ((ILookupHelper<Person>)InnerData.Director).GetItems(null, null), person, null))
((ILookupHelper<Person>)InnerData.Director).SetItem(person, null, properties);
}

#endregion
Expand Down Expand Up @@ -415,8 +415,8 @@ public void SetCertification(Rating rating, JsNotation<Blueprint41.UnitTest.Data
if (Substances.HasValue) properties.Add("Substances", Substances.Value?.ToString());
if (SexAndNudity.HasValue) properties.Add("SexAndNudity", SexAndNudity.Value?.ToString());

((ILookupHelper<Rating>)InnerData.Certification).SetItem(rating, null, properties);

if (LazySet(Members.Certification, ((ILookupHelper<Rating>)InnerData.Certification).GetItems(null, null), rating, null))
((ILookupHelper<Rating>)InnerData.Certification).SetItem(rating, null, properties);
}

#endregion
Expand Down Expand Up @@ -450,16 +450,16 @@ internal MovieMembers() { }

#region Members for interface IMovie

public Property Title { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Movie"].Properties["Title"];
public Property Director { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Movie"].Properties["Director"];
public Property Actors { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Movie"].Properties["Actors"];
public Property Certification { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Movie"].Properties["Certification"];
public EntityProperty Title { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Movie"].Properties["Title"];
public EntityProperty Director { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Movie"].Properties["Director"];
public EntityProperty Actors { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Movie"].Properties["Actors"];
public EntityProperty Certification { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Movie"].Properties["Certification"];
#endregion

#region Members for interface IBaseEntity

public Property Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public Property LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
public EntityProperty Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public EntityProperty LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
#endregion

}
Expand Down
3 changes: 2 additions & 1 deletion Blueprint41.UnitTest/Entities/PERSON_DIRECTED.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private PERSON_DIRECTED(string elementId, Person @in, Movie @out, Dictionary<str
public Person Person { get; private set; }

/// <summary>
/// Restaurant (Out Node)
/// Movie (Out Node)
/// </summary>
public Movie Movie { get; private set; }

Expand Down Expand Up @@ -74,6 +74,7 @@ public static List<PERSON_DIRECTED> Where(Func<Alias, QueryCondition[]> expressi
{
var query = Transaction.CompiledQuery
.Match(node.Person.Alias(out var inAlias).In.PERSON_DIRECTED.Alias(out var relAlias).Out.Movie.Alias(out var outAlias))

.Where(expression.Invoke(new Alias(relAlias, inAlias, outAlias)))
.Return(relAlias.ElementId.As("elementId"), relAlias.Properties("properties"), inAlias.As("in"), outAlias.As("out"))
.Compile();
Expand Down
1 change: 1 addition & 0 deletions Blueprint41.UnitTest/Entities/PERSON_EATS_AT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public static List<PERSON_EATS_AT> Where(Func<Alias, QueryCondition[]> expressio
{
var query = Transaction.CompiledQuery
.Match(node.Person.Alias(out var inAlias).In.PERSON_EATS_AT.Alias(out var relAlias).Out.Restaurant.Alias(out var outAlias))

.Where(expression.Invoke(new Alias(relAlias, inAlias, outAlias)))
.Return(relAlias.ElementId.As("elementId"), relAlias.Properties("properties"), inAlias.As("in"), outAlias.As("out"))
.Compile();
Expand Down
3 changes: 2 additions & 1 deletion Blueprint41.UnitTest/Entities/PERSON_LIVES_IN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private PERSON_LIVES_IN(string elementId, Person @in, City @out, Dictionary<stri
public Person Person { get; private set; }

/// <summary>
/// Restaurant (Out Node)
/// City (Out Node)
/// </summary>
public City City { get; private set; }

Expand Down Expand Up @@ -87,6 +87,7 @@ public static List<PERSON_LIVES_IN> Where(Func<Alias, QueryCondition[]> expressi
{
var query = Transaction.CompiledQuery
.Match(node.Person.Alias(out var inAlias).In.PERSON_LIVES_IN.Alias(out var relAlias).Out.City.Alias(out var outAlias))

.Where(expression.Invoke(new Alias(relAlias, inAlias, outAlias)))
.Return(relAlias.ElementId.As("elementId"), relAlias.Properties("properties"), inAlias.As("in"), outAlias.As("out"))
.Compile();
Expand Down
31 changes: 16 additions & 15 deletions Blueprint41.UnitTest/Entities/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ public IEnumerable<CollectionItem<City>> GetCities(DateTime? from, DateTime? til
{
return ((ILookupHelper<City>)InnerData.City).GetItems(from, till);
}
public void SetCity(City value, DateTime? moment)
{
if (LazySet(Members.City, ((ILookupHelper<City>)InnerData.City).GetItems(moment, null), value, moment))
((ILookupHelper<City>)InnerData.City).SetItem(value, moment);
}
//public void SetCity(City value, DateTime? moment)
//{
// if (LazySet(Members.City, ((ILookupHelper<City>)InnerData.City).GetItems(moment, null), value, moment))
// ((ILookupHelper<City>)InnerData.City).SetItem(value, moment);
//}

#endregion
#region Members for interface IBaseEntity
Expand Down Expand Up @@ -671,7 +671,8 @@ public void SetCity(City city, DateTime? moment, JsNotation<string> AddressLine1
if (AddressLine2.HasValue) properties.Add("AddressLine2", AddressLine2.Value);
if (AddressLine3.HasValue) properties.Add("AddressLine3", AddressLine3.Value);

((ILookupHelper<City>)InnerData.City).SetItem(city, moment, properties);
if (LazySet(Members.City, ((ILookupHelper<City>)InnerData.City).GetItems(moment, null), city, moment))
((ILookupHelper<City>)InnerData.City).SetItem(city, moment, properties);
}

#endregion
Expand Down Expand Up @@ -705,19 +706,19 @@ internal PersonMembers() { }

#region Members for interface IPerson

public Property Name { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["Name"];
public Property Restaurants { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["Restaurants"];
public Property DirectedMovies { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["DirectedMovies"];
public Property ActedInMovies { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["ActedInMovies"];
public Property StreamingServiceSubscriptions { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["StreamingServiceSubscriptions"];
public Property WatchedMovies { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["WatchedMovies"];
public Property City { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["City"];
public EntityProperty Name { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["Name"];
public EntityProperty Restaurants { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["Restaurants"];
public EntityProperty DirectedMovies { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["DirectedMovies"];
public EntityProperty ActedInMovies { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["ActedInMovies"];
public EntityProperty StreamingServiceSubscriptions { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["StreamingServiceSubscriptions"];
public EntityProperty WatchedMovies { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["WatchedMovies"];
public EntityProperty City { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Person"].Properties["City"];
#endregion

#region Members for interface IBaseEntity

public Property Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public Property LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
public EntityProperty Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public EntityProperty LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
#endregion

}
Expand Down
5 changes: 3 additions & 2 deletions Blueprint41.UnitTest/Entities/RESTAURANT_LOCATED_AT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ private RESTAURANT_LOCATED_AT(string elementId, Restaurant @in, City @out, Dicti
internal string _elementId { get; private set; }

/// <summary>
/// Person (In Node)
/// Restaurant (In Node)
/// </summary>
public Restaurant Restaurant { get; private set; }

/// <summary>
/// Restaurant (Out Node)
/// City (Out Node)
/// </summary>
public City City { get; private set; }

Expand Down Expand Up @@ -74,6 +74,7 @@ public static List<RESTAURANT_LOCATED_AT> Where(Func<Alias, QueryCondition[]> ex
{
var query = Transaction.CompiledQuery
.Match(node.Restaurant.Alias(out var inAlias).In.RESTAURANT_LOCATED_AT.Alias(out var relAlias).Out.City.Alias(out var outAlias))

.Where(expression.Invoke(new Alias(relAlias, inAlias, outAlias)))
.Return(relAlias.ElementId.As("elementId"), relAlias.Properties("properties"), inAlias.As("in"), outAlias.As("out"))
.Compile();
Expand Down
10 changes: 5 additions & 5 deletions Blueprint41.UnitTest/Entities/Rating.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ internal RatingMembers() { }

#region Members for interface IRating

public Property Code { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Rating"].Properties["Code"];
public Property Name { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Rating"].Properties["Name"];
public Property Description { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Rating"].Properties["Description"];
public EntityProperty Code { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Rating"].Properties["Code"];
public EntityProperty Name { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Rating"].Properties["Name"];
public EntityProperty Description { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Rating"].Properties["Description"];
#endregion

#region Members for interface IBaseEntity

public Property Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public Property LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
public EntityProperty Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public EntityProperty LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
#endregion

}
Expand Down
14 changes: 7 additions & 7 deletions Blueprint41.UnitTest/Entities/Restaurant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ public void SetCity(City city)
{
Dictionary<string, object> properties = new Dictionary<string, object>();

((ILookupHelper<City>)InnerData.City).SetItem(city, null, properties);

if (LazySet(Members.City, ((ILookupHelper<City>)InnerData.City).GetItems(null, null), city, null))
((ILookupHelper<City>)InnerData.City).SetItem(city, null, properties);
}

#endregion
Expand Down Expand Up @@ -357,15 +357,15 @@ internal RestaurantMembers() { }

#region Members for interface IRestaurant

public Property Name { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Restaurant"].Properties["Name"];
public Property City { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Restaurant"].Properties["City"];
public Property Persons { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Restaurant"].Properties["Persons"];
public EntityProperty Name { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Restaurant"].Properties["Name"];
public EntityProperty City { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Restaurant"].Properties["City"];
public EntityProperty Persons { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["Restaurant"].Properties["Persons"];
#endregion

#region Members for interface IBaseEntity

public Property Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public Property LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
public EntityProperty Uid { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["Uid"];
public EntityProperty LastModifiedOn { get; } = Blueprint41.UnitTest.DataStore.MockModel.Model.Entities["BaseEntity"].Properties["LastModifiedOn"];
#endregion

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private SUBSCRIBED_TO_STREAMING_SERVICE(string elementId, Person @in, StreamingS
public Person Person { get; private set; }

/// <summary>
/// Restaurant (Out Node)
/// StreamingService (Out Node)
/// </summary>
public StreamingService StreamingService { get; private set; }

Expand Down Expand Up @@ -81,6 +81,7 @@ public static List<SUBSCRIBED_TO_STREAMING_SERVICE> Where(Func<Alias, QueryCondi
{
var query = Transaction.CompiledQuery
.Match(node.Person.Alias(out var inAlias).In.SUBSCRIBED_TO_STREAMING_SERVICE.Alias(out var relAlias).Out.StreamingService.Alias(out var outAlias))

.Where(expression.Invoke(new Alias(relAlias, inAlias, outAlias)))
.Return(relAlias.ElementId.As("elementId"), relAlias.Properties("properties"), inAlias.As("in"), outAlias.As("out"))
.Compile();
Expand Down
Loading

0 comments on commit f2640bd

Please sign in to comment.