public void Delete_A_Single_Entity_Using_Delete() { //arrange var bodyParameter = new EqualsBinaryOperatorParameter ( new MemberSelectorOperatorParameter("FullName", new ParameterOperatorParameter(parameterName)), new ConstantOperatorParameter("Carson Alexander") ); //act DoTest<StudentModel, Student> ( bodyParameter, null, null, parameterName, (StudentModel studentModel, ISchoolRepository repository) => { IExpressionParameter expressionParameter = GetFilterParameter<StudentModel>(bodyParameter, parameterName); Expression<Func<StudentModel, bool>> expression = ProjectionOperations<StudentModel, Student>.GetFilter ( serviceProvider.GetRequiredService<IMapper>().MapToOperator(expressionParameter) ); PersistenceOperations<StudentModel, Student>.Delete(repository, expression); }, returnValue => { Assert.Null(returnValue); }, "$it => ($it.FullName == \"Carson Alexander\")" ); }
public void Update_A_Single_Entity() { //arrange var bodyParameter = new EqualsBinaryOperatorParameter ( new MemberSelectorOperatorParameter("FullName", new ParameterOperatorParameter(parameterName)), new ConstantOperatorParameter("Carson Alexander") ); //act DoTest<StudentModel, Student> ( bodyParameter, null, null, parameterName, (StudentModel studentModel, ISchoolRepository repository) => { studentModel.EnrollmentDate = new DateTime(2021, 2, 8); studentModel.EntityState = LogicBuilder.Domain.EntityStateType.Modified; PersistenceOperations<StudentModel, Student>.Save(repository, studentModel); }, returnValue => { Assert.Equal(new DateTime(2021, 2, 8), returnValue.EnrollmentDate); }, "$it => ($it.FullName == \"Carson Alexander\")" ); }
public void Add_An_Object_Graph() { //arrange var bodyParameter = new EqualsBinaryOperatorParameter ( new MemberSelectorOperatorParameter("FullName", new ParameterOperatorParameter(parameterName)), new ConstantOperatorParameter("Roger Milla") ); //act DoTest<StudentModel, Student> ( bodyParameter, null, new SelectExpandDefinitionParameters { ExpandedItems = new List<SelectExpandItemParameters> { new SelectExpandItemParameters { MemberName = "Enrollments" } } }, parameterName, (StudentModel studentModel, ISchoolRepository repository) => { PersistenceOperations<StudentModel, Student>.SaveGraph ( repository, new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, EnrollmentDate = new DateTime(2021, 2, 8), Enrollments = new List<EnrollmentModel> { new EnrollmentModel { CourseID = 1050, Grade = Domain.Entities.Grade.A }, new EnrollmentModel { CourseID = 4022, Grade = Domain.Entities.Grade.A }, new EnrollmentModel { CourseID = 4041, Grade = Domain.Entities.Grade.A } }, FirstName = "Roger", LastName = "Milla" } ); }, returnValue => { Assert.Equal(new DateTime(2021, 2, 8), returnValue.EnrollmentDate); Assert.Equal(3, returnValue.Enrollments.Count()); }, "$it => ($it.FullName == \"Roger Milla\")" ); }
public void Add_An_Entry_To_A_Child_Collection() { //arrange var bodyParameter = new EqualsBinaryOperatorParameter ( new MemberSelectorOperatorParameter("FullName", new ParameterOperatorParameter(parameterName)), new ConstantOperatorParameter("Carson Alexander") ); //act DoTest<StudentModel, Student> ( bodyParameter, null, new SelectExpandDefinitionParameters { ExpandedItems = new List<SelectExpandItemParameters> { new SelectExpandItemParameters { MemberName = "Enrollments" } } }, parameterName, (StudentModel studentModel, ISchoolRepository repository) => { studentModel.EnrollmentDate = new DateTime(2021, 2, 8); studentModel.Enrollments.Add ( new EnrollmentModel { CourseID = 3141, Grade = Domain.Entities.Grade.B, EntityState = LogicBuilder.Domain.EntityStateType.Added } ); studentModel.EntityState = LogicBuilder.Domain.EntityStateType.Modified; PersistenceOperations<StudentModel, Student>.SaveGraph(repository, studentModel); }, returnValue => { Assert.Equal(new DateTime(2021, 2, 8), returnValue.EnrollmentDate); Assert.Equal(Domain.Entities.Grade.B, returnValue.Enrollments.Single(e => e.CourseID == 3141).Grade); Assert.Equal(4, returnValue.Enrollments.Count()); }, "$it => ($it.FullName == \"Carson Alexander\")" ); }
public DummyOperatorParameterConstructor ( AddBinaryOperatorParameter addBinaryOperatorParameter, AllOperatorParameter allOperatorParameter, AndBinaryOperatorParameter andBinaryOperatorParameter, AnyOperatorParameter anyOperatorParameter, AsQueryableOperatorParameter asQueryableOperatorParameter, AverageOperatorParameter averageOperatorParameter, BinaryOperatorParameter binaryOperatorParameter, CastOperatorParameter castOperatorParameter, CeilingOperatorParameter ceilingOperatorParameter, CollectionCastOperatorParameter collectionCastOperatorParameter, CollectionConstantOperatorParameter collectionConstantOperatorParameter, ConcatOperatorParameter concatOperatorParameter, ConstantOperatorParameter constantOperatorParameter, ContainsOperatorParameter containsOperatorParameter, ConvertCharArrayToStringOperatorParameter convertCharArrayToStringOperatorParameter, ConvertOperatorParameter convertOperatorParameter, ConvertToEnumOperatorParameter convertToEnumOperatorParameter, ConvertToNullableUnderlyingValueOperatorParameter convertToNullableUnderlyingValueOperatorParameter, ConvertToNumericDateOperatorParameter convertToNumericDateOperatorParameter, ConvertToNumericTimeOperatorParameter convertToNumericTimeOperatorParameter, ConvertToStringOperatorParameter convertToStringOperatorParameter, CountOperatorParameter countOperatorParameter, CustomMethodOperatorParameter customMethodOperatorParameter, DateOperatorParameter dateOperatorParameter, DayOperatorParameter dayOperatorParameter, DistinctOperatorParameter distinctOperatorParameter, DivideBinaryOperatorParameter divideBinaryOperatorParameter, EndsWithOperatorParameter endsWithOperatorParameter, EqualsBinaryOperatorParameter equalsBinaryOperatorParameter, FilterLambdaOperatorParameter filterLambdaOperatorParameter, FirstOperatorParameter firstOperatorParameter, FirstOrDefaultOperatorParameter firstOrDefaultOperatorParameter, FloorOperatorParameter floorOperatorParameter, FractionalSecondsOperatorParameter fractionalSecondsOperatorParameter, GreaterThanBinaryOperatorParameter greaterThanBinaryOperatorParameter, GreaterThanOrEqualsBinaryOperatorParameter greaterThanOrEqualsBinaryOperatorParameter, GroupByOperatorParameter groupByOperatorParameter, HasOperatorParameter hasOperatorParameter, HourOperatorParameter hourOperatorParameter, IEnumerableSelectorLambdaOperatorParameter enumerableSelectorLambdaOperatorParameter, InOperatorParameter inOperatorParameter, IndexOfOperatorParameter indexOfOperatorParameter, IsOfOperatorParameter isOfOperatorParameter, LastOperatorParameter lastOperatorParameter, LastOrDefaultOperatorParameter lastOrDefaultOperatorParameter, LengthOperatorParameter lengthOperatorParameter, LessThanBinaryOperatorParameter lessThanBinaryOperatorParameter, LessThanOrEqualsBinaryOperatorParameter lessThanOrEqualsBinaryOperatorParameter, MaxDateTimeOperatorParameter maxDateTimeOperatorParameter, MaxOperatorParameter maxOperatorParameter, MemberInitOperatorParameter memberInitOperatorParameter, MemberSelectorOperatorParameter memberSelectorOperatorParameter, MinDateTimeOperatorParameter minDateTimeOperatorParameter, MinOperatorParameter minOperatorParameter, MinuteOperatorParameter minuteOperatorParameter, ModuloBinaryOperatorParameter moduloBinaryOperatorParameter, MonthOperatorParameter monthOperatorParameter, MultiplyBinaryOperatorParameter multiplyBinaryOperatorParameter, NegateOperatorParameter negateOperatorParameter, NotOperatorParameter notOperatorParameter, NotEqualsBinaryOperatorParameter notEqualsBinaryOperatorParameter, NowDateTimeOperatorParameter nowDateTimeOperatorParameter, OrBinaryOperatorParameter orBinaryOperatorParameter, OrderByOperatorParameter orderByOperatorParameter, ParameterOperatorParameter parameterOperatorParameter, RoundOperatorParameter roundOperatorParameter, SecondOperatorParameter secondOperatorParameter, SelectOperatorParameter selectOperatorParameter, SelectManyOperatorParameter selectManyOperatorParameter, SelectorLambdaOperatorParameter selectorLambdaOperatorParameter, SingleOperatorParameter singleOperatorParameter, SingleOrDefaultOperatorParameter singleOrDefaultOperatorParameter, SkipOperatorParameter skipOperatorParameter, StartsWithOperatorParameter startsWithOperatorParameter, SubstringOperatorParameter substringOperatorParameter, SubtractBinaryOperatorParameter subtractBinaryOperatorParameter, SumOperatorParameter sumOperatorParameter, TakeOperatorParameter takeOperatorParameter, ThenByOperatorParameter thenByOperatorParameter, TimeOperatorParameter timeOperatorParameter, ToListOperatorParameter toListOperatorParameter, ToLowerOperatorParameter toLowerOperatorParameter, TotalOffsetMinutesOperatorParameter totalOffsetMinutesOperatorParameter, TotalSecondsOperatorParameter totalSecondsOperatorParameter, ToUpperOperatorParameter toUpperOperatorParameter, TrimOperatorParameter trimOperatorParameter, WhereOperatorParameter whereOperatorParameter, YearOperatorParameter yearOperatorParameter ) { }