public void TestSerializationModerator() { var seria = BinarySerializer.SerializeToString(GetModelWhenCardsAndMinerChecked(LocicalBinaryOperator.or)); var deSeria = BinarySerializer.DeserializeFromString <IBaseConditionModel>(seria); var moderator = new FarmVisitor(); var result = moderator.Validate(deSeria, FakeState()); Assert.AreEqual(result.IsValid, true); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <Moderator>().As <IModerator>(); builder.RegisterType <FarmVisitor>().As <IFarmVisitor <Result> >(); builder.Register(x => !File.Exists(Path.Combine(assemblyFolder, "Moderator.bin")) ? new ModeratorConfigure() : BinarySerializer.DeserializeFromString <ModeratorConfigure>(File.ReadAllText(Path.Combine(assemblyFolder, "Moderator.bin")))) .As <ModeratorConfigure>().SingleInstance(); base.Load(builder); }
public void DeserializeFromString_Binary() { binarySerializer.DeserializeFromString <TestClass>(binaryFromString); }