// Copyright (c) Kaylumah, 2024. All rights reserved.
// See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq.Expressions;
using Ssg.Extensions.Metadata.Abstractions;
using Xunit;
namespace Test.Unit.FormerXunit;
public class TempTest
{
[Fact]
public void Test1()
{
Serialize.Linq.Serializers.JsonSerializer innerSerializer = new Serialize.Linq.Serializers.JsonSerializer();
Serialize.Linq.Serializers.ExpressionSerializer serializer
= new Serialize.Linq.Serializers.ExpressionSerializer(innerSerializer);
List<PageMetaData> list = new List<PageMetaData>();
Expression<Func<PageMetaData, bool>> expression = x => x.Title == "test";
string expressionText = serializer.SerializeText(expression);
}
[Fact]
public void Test2()
{
Serialize.Linq.Serializers.XmlSerializer innerSerializer = new Serialize.Linq.Serializers.XmlSerializer();
Serialize.Linq.Serializers.ExpressionSerializer serializer
= new Serialize.Linq.Serializers.ExpressionSerializer(innerSerializer);
List<PageMetaData> list = new List<PageMetaData>();
Expression<Func<PageMetaData, bool>> expression = x => x.Title == "test";
string expressionText = serializer.SerializeText(expression);
// Deserialize the expression and cast it back to the original type
Expression<Func<PageMetaData, bool>> deserializedExpression = serializer.DeserializeText(expressionText) as Expression<Func<PageMetaData, bool>>;
// Use the deserialized expression
Func<PageMetaData, bool> func = deserializedExpression.Compile();
}
[Fact]
public void Test3()
{
// static bool TestInner(PageMetaData pageMetaData)
// {
// return true;
// }
Serialize.Linq.Serializers.XmlSerializer innerSerializer = new Serialize.Linq.Serializers.XmlSerializer();
Serialize.Linq.Serializers.ExpressionSerializer serializer
= new Serialize.Linq.Serializers.ExpressionSerializer(innerSerializer);
Expression<Func<PageMetaData, bool>> expression = x => TestInner2(x);
string expressionText = serializer.SerializeText(expression);
}
static bool TestInner2(PageMetaData pageMetaData)
{
Debug.Assert(pageMetaData != null);
return false;
}
}