Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public void DeserializeFromString_Binary()
 {
     binarySerializer.DeserializeFromString <TestClass>(binaryFromString);
 }