public void La()
        {
            string templateStr = @"
#<laconf>
  compiler
  {
     base-class-name=""Azos.Tests.Unit.Templatization.TeztTemplate""
     namespace=""TestWebApp.Templates""
     summary=""Test master page""

    using {ns=""Azos.Web"" }
    using {ns=""Azos.RecordModel"" }
    using {ns=""BusinessLogic"" }

    attribute {decl=""BusinessLogic.SultanPermission(4)"" }

   }
#</laconf>";

            TemplateStringContentSource templateSrc = new TemplateStringContentSource(templateStr);

            TextCSTemplateCompiler compiler = new TextCSTemplateCompiler(templateSrc);

            compiler.Compile();

            Aver.AreEqual(1, compiler.Count());

            CompileUnit unit = compiler.First();

            Aver.IsNull(unit.CompilationException);
            Aver.IsNull(unit.CompiledTemplateType);
            Aver.IsTrue(unit.CompiledTemplateTypeName.IsNotNullOrEmpty());
            Aver.AreSameRef(templateSrc, unit.TemplateSource);
            Aver.AreEqual(templateStr, templateSrc.Content);
        }
Ejemplo n.º 2
0
        public void Circular1()
        {
            using (var ms = new MemoryStream())
            {
                var s = new SlimSerializer();

                var dIn = new cA
                {
                    A = 2190,
                    B = 23232
                };

                dIn.Child = new cA {
                    A = -100, B = -900, Child = dIn
                };                                             //circular reference!!!


                s.Serialize(ms, dIn);
                ms.Seek(0, SeekOrigin.Begin);

                var dOut = (cA)s.Deserialize(ms);

                Aver.AreEqual(2190, dOut.A);
                Aver.AreEqual(23232, dOut.B);
                Aver.IsNotNull(dOut.Child);
                Aver.AreEqual(-100, dOut.Child.A);
                Aver.AreEqual(-900, dOut.Child.B);
                Aver.AreSameRef(dOut, dOut.Child.Child);
            }
        }
Ejemplo n.º 3
0
        public void ValidationBatchException_Concat_06()
        {
            var error1 = new AzosException("error1");
            var error2 = new ArgumentException("error2");

            var got = ValidationBatchException.Concatenate(error1, error2);

            Aver.IsNotNull(got);
            var be = got as ValidationBatchException;

            Aver.IsNotNull(be);

            Aver.IsNotNull(be.Batch);
            Aver.AreEqual(2, be.Batch.Count);
            Aver.AreSameRef(error1, be.Batch[0]);
            Aver.AreSameRef(error2, be.Batch[1]);

            var got2 = ValidationBatchException.Concatenate(got, error2);
            var be2  = got2 as ValidationBatchException;

            Aver.IsNotNull(be2);

            Aver.IsNotNull(be2.Batch);
            Aver.AreEqual(3, be2.Batch.Count);
            Aver.AreSameRef(error1, be2.Batch[0]);
            Aver.AreSameRef(error2, be2.Batch[1]);
            Aver.AreSameRef(error2, be2.Batch[2]);
        }
Ejemplo n.º 4
0
 public override void AssertInjectionCorrectness(IApplication app)
 {
     base.AssertInjectionCorrectness(app);
     Aver.AreSameRef(app.ModuleRoot.Get <IMyModule>(), m_MyModule1);
     Aver.AreSameRef(app.ModuleRoot.Get <IMyModule>("Module2"), m_MyModule2);
     Aver.AreSameRef(app.ModuleRoot.Get <IMyModule>("Module3"), m_MyModule3);
 }
Ejemplo n.º 5
0
        public void T08_PreserveReferenceToTheSameArray()
        {
            using (var ms = new MemoryStream())
            {
                var s = new SlimSerializer();

                var bytes   = new byte[] { 0x07, 0x12 };
                var strings = new string[] { "Veingarten", "Vecherovskiy", "Zahar Gubar'" };
                var ints    = new int[] { -100, 2345, 19044, 888889 };
                var dIn     = new C11()
                {
                    FBytes = bytes,
                    FC11   = new C11_1()
                    {
                        FBytes_1 = bytes, FStrings_1 = strings, FInts_1 = ints
                    },
                    FC12 = new C11_2()
                    {
                        FBytes_2 = bytes, FStrings_2 = strings, FInts_2 = ints
                    }
                };

                s.Serialize(ms, dIn);
                ms.Seek(0, SeekOrigin.Begin);

                var dOut = (C11)s.Deserialize(ms);

                Aver.AreSameRef(dOut.FBytes, dOut.FC11.FBytes_1);
                Aver.AreSameRef(dOut.FBytes, dOut.FC12.FBytes_2);

                Aver.AreSameRef(dOut.FC11.FStrings_1, dOut.FC12.FStrings_2);
                Aver.AreSameRef(dOut.FC11.FInts_1, dOut.FC12.FInts_2);
            }
        }
Ejemplo n.º 6
0
        public void CreateByConfigurationOwnDaemonWithTwoSinks()
        {
            var conf = @"
log
{
  name='YourFriendLogger'
  write-interval-ms=0

  sink
  {
    name='CatchAll'
    order=100
    type='Azos.Log.Sinks.MemoryBufferSink, Azos'
  }

  sink
  {
    name='Problems'
    min-level=Warning
    order=0
    type='Azos.Log.Sinks.MemoryBufferSink, Azos'
  }
}".AsLaconicConfig();

            using (var logger = FactoryUtils.MakeAndConfigureComponent <LogDaemon>(NOPApplication.Instance, conf, typeof(LogDaemon)))
            {
                Aver.AreEqual("YourFriendLogger", logger.Name);                   //name got set
                Aver.AreEqual(LogDaemon.MIN_INTERVAL_MSEC, logger.WriteInterval); //got set the minimum flush period from config
                Aver.AreEqual(2, logger.Sinks.Count);

                logger.Start();
                Aver.IsTrue(logger.Running);

                var s0 = logger.Sinks["Problems"] as MemoryBufferSink;
                var s1 = logger.Sinks["CatchAll"] as MemoryBufferSink;//catchall order =100

                Aver.IsNotNull(s0);
                Aver.IsNotNull(s1);
                Aver.AreSameRef(s0, logger.Sinks[0]);
                Aver.AreSameRef(s1, logger.Sinks[1]);

                Aver.IsNull(logger.Sinks["TheOneWhich isNotthere"]);
                Aver.IsNull(logger.Sinks[324234]);

                logger.Write(MessageType.Info, "This was info");
                logger.Write(MessageType.Debug, "Now debug");
                logger.Write(MessageType.Error, "And now error");

                Thread.Sleep(DAEMON_FLUSH_WAIT_MS);//make sure async flush happens

                Aver.AreEqual(3, s1.Buffered.Count());
                Aver.AreEqual(1, s0.Buffered.Count());

                Aver.AreEqual("And now error", s0.Buffered.FirstOrDefault().Text);
                Aver.AreEqual("This was info", s1.Buffered.FirstOrDefault().Text);
                Aver.AreEqual("Now debug", s1.Buffered.Skip(1).FirstOrDefault().Text);
                Aver.AreEqual("And now error", s1.Buffered.Skip(2).FirstOrDefault().Text);
            }
        }
Ejemplo n.º 7
0
        public void ManyToMany()
        {
            var cfg = @"
app
{
  web-settings
  {
    content-type-mappings
    {
        map
        {
          extensions='f1,f2'
          content-type='custom/xyz'
          binary=true
        }

        map
        {
          extensions='f3'
          content-type='custom/xyz'
          binary=false
          name{eng{n='F3' d='F3 file'}}
        }
    }
  }
}
".AsLaconicConfig();

            using (var app = new AzosApplication(null, cfg))
            {
                var maps = app.GetContentTypeMappings();
                Aver.IsNotNull(maps);

                var map1 = maps.MapFileExtension("f1");
                var map2 = maps.MapFileExtension("f2");
                var map3 = maps.MapFileExtension("f3");
                Aver.IsNotNull(map1);
                Aver.IsNotNull(map2);
                Aver.IsNotNull(map3);

                Aver.AreSameRef(map1, map2);
                Aver.AreNotSameRef(map2, map3);

                Aver.IsFalse(map1.IsGeneric);
                Aver.IsFalse(map3.IsGeneric);
                Aver.IsTrue(map1.IsBinary);
                Aver.IsFalse(map3.IsBinary);
                Aver.AreEqual("custom/xyz", map1.ContentType);
                Aver.AreEqual("custom/xyz", map3.ContentType);

                Aver.IsNull(map1.Name["eng"].Description);
                Aver.AreEqual("F3 file", map3.Name["eng"].Description);

                var mappings = maps.MapContentType("custom/xyz").ToArray();
                Aver.AreEqual(2, mappings.Length);
                Aver.AreSameRef(map1, mappings[0]);
                Aver.AreSameRef(map3, mappings[1]);
            }
        }
        public void CompilationProperties()
        {
            const string srcStr = @"#<conf>
          <compiler base-class-name=""Azos.Tests.Unit.Templatization.TeztTemplate""
                    namespace=""Azos.Tests.Unit.Templatization""
                    abstract=""true""
                    summary=""Test master page""
           />
        #</conf>
        #[class]

            public string Title { get {return ""aaaaa""; } }


            protected abstract void renderHeader();
            protected abstract void renderBody(bool showDetails);
            protected abstract void renderFooter();


        #[render]
        <html>
         <head>
           <title>?[Title]</title>
         </head>
         <body>

          <h1>This is Header</h1>
           @[renderHeader();]

          <h1>This is Body</h1>
           @[renderBody(true);]
          <p>This is in master page</p>

          <h1>This is Footer</h1>
           @[renderFooter();]

         </body>
        </html> ";

            TemplateStringContentSource src = new TemplateStringContentSource(srcStr);

            TextCSTemplateCompiler compiler = new TextCSTemplateCompiler(src);

            compiler.Compile();

            Aver.AreEqual(1, compiler.Count());

            CompileUnit unit = compiler.First();

            Aver.IsNull(unit.CompilationException);
            Aver.IsNull(unit.CompiledTemplateType);
            Aver.IsTrue(unit.CompiledTemplateTypeName.IsNotNullOrEmpty());
            Aver.AreSameRef(src, unit.TemplateSource);
            Aver.AreEqual(srcStr, src.Content);
        }
Ejemplo n.º 9
0
        public void Test_InjectionTarget_AppInjection_True()
        {
            using (var app = new AzosApplication(null, BASE_CONF))
            {
                var target = new InjectionTarget_AppInjection_True();
                app.DependencyInjector.InjectInto(target);

                target.AssertAllInjectionsNull();
                Aver.AreSameRef(app, target.AppInjectedByHand);
                Aver.AreEqual(app.DependencyInjector.ComponentSID, target.InjectorSID);
            }
        }
Ejemplo n.º 10
0
            public string Data;//<-- this gotta be serializable

            public virtual void AssertInjectionCorrectness(IApplication app)
            {
                Aver.AreSameRef(app, m_App);
                Aver.AreSameRef(app, m_App2);
                Aver.AreSameRef(app, m_App3);

                Aver.AreSameRef(app.Log, m_LogAsLog);
                Aver.AreSameRef(app.Log, m_LogAsObject);
                Aver.AreSameRef(app.DataStore, m_DataStore);
                Aver.AreSameRef(app.Glue, m_Glue);
                Aver.AreSameRef(app.Instrumentation, m_Instrumentation);
                Aver.AreSameRef(app.TimeSource, m_TimeSource);
            }
Ejemplo n.º 11
0
        public void Of_1()
        {
            var cfg = "a=-1 b=-2".AsLaconicConfig();

            Aver.IsTrue(cfg.Of("a").Exists);
            Aver.IsTrue(cfg.Of("b").Exists);
            Aver.IsFalse(cfg.Of("dont-exist").Exists);

            Aver.AreSameRef(cfg.AttrByName("a"), cfg.Of("a"));
            Aver.AreSameRef(cfg.AttrByName("b"), cfg.Of("b"));

            Aver.AreEqual(-1, cfg.Of("A").ValueAsInt());
            Aver.AreEqual(-2, cfg.Of("B").ValueAsInt());
        }
Ejemplo n.º 12
0
        public void CreateByCodeOwnDaemon()
        {
            using (var logger = new LogDaemon(NOPApplication.Instance))
            {
                logger.WriteInterval = 0;                          //set the minimum flush period

                Aver.Throws <AzosException>(() => logger.Start()); //can not start daemon with no sinks
                Aver.IsFalse(logger.Running);

                Aver.IsFalse(logger.Sinks.Any());

                using (var sink = new MemoryBufferSink(logger))
                {
                    sink.Name.See();
                    Aver.IsTrue(sink.Name.StartsWith("MemoryBufferSink.")); //anonymous sinks get their name from their:   'type.fid'

                    logger.Start();                                         //now it can start
                    Aver.IsTrue(logger.Running);

                    Aver.AreSameRef(sink, logger.Sinks.First()); //now there is a sink registered which is this one
                    Aver.IsTrue(sink.Running);                   //it was auto-started by the logger

                    logger.Write(new Message {
                        Type = MessageType.DebugB, Text = "This is a message #1"
                    });                                          //so this messages goes in it

                    Thread.Sleep(DAEMON_FLUSH_WAIT_MS);          //make sure async flush happens

                    Aver.IsTrue(sink.Buffered.Any());            //because sink was active

                    var logged = sink.Buffered.FirstOrDefault(); // we get the first message buffered

                    Aver.AreEqual("This is a message #1", logged.Text);
                    Aver.IsTrue(MessageType.DebugB == logged.Type);

                    sink.WaitForCompleteStop();//stop the sink
                    Aver.IsFalse(sink.Running);
                    logger.Write(new Message {
                        Type = MessageType.Debug, Text = "This is a message #2"
                    });

                    Thread.Sleep(DAEMON_FLUSH_WAIT_MS);      //make sure async flush happens

                    Aver.AreEqual(1, sink.Buffered.Count()); //because sink was not turned on for 2nd, only the first message got in, 2nd got lost
                }

                Aver.IsFalse(logger.Sinks.Any());//again, no sinks left
            }
        }
Ejemplo n.º 13
0
        public void T12_DictComparerComplex()
        {
            using (var ms = new MemoryStream())
            {
                var s = new SlimSerializer();

                var cmpr = new Comparer1();

                var c1 = new C13();
                var c2 = new C13();

                var dict1 = new Dictionary <int, C13>(cmpr);
                dict1[1] = c1;
                dict1[2] = c1;
                dict1[3] = c2;
                var dict2 = new Dictionary <int, C13>(cmpr);
                dict2[1] = c2;
                dict2[2] = c1;

                var dIn = new List <S3>();
                dIn.Add(new S3()
                {
                    FDict = dict1
                });
                dIn.Add(new S3()
                {
                    FDict = dict1
                });
                dIn.Add(new S3()
                {
                    FDict = dict2
                });

                s.Serialize(ms, dIn);
                ms.Seek(0, SeekOrigin.Begin);

                var dOut = (List <S3>)s.Deserialize(ms);

                Aver.AreSameRef(dOut[0].FDict, dOut[1].FDict);
                Aver.AreNotSameRef(dOut[0].FDict, dOut[2].FDict);

                Aver.AreSameRef(dOut[0].FDict[1], dOut[0].FDict[2]);
                Aver.AreNotSameRef(dOut[0].FDict[1], dOut[0].FDict[3]);

                Aver.AreSameRef(dOut[0].FDict[1], dOut[2].FDict[2]);
                Aver.AreSameRef(dOut[0].FDict[3], dOut[2].FDict[1]);
            }
        }
Ejemplo n.º 14
0
        public void DefaultMappings_MapFileExt_MapContentType()
        {
            using (var app = new AzosApplication(null, null))
            {
                var maps = app.GetContentTypeMappings();
                Aver.IsNotNull(maps);

                var map = maps.MapFileExtension("txt");
                Aver.IsNotNull(map);
                Aver.AreEqual("text/plain", map.ContentType);

                var mappings = maps.MapContentType("text/plain").ToArray();
                Aver.AreEqual(1, mappings.Length);
                Aver.AreSameRef(map, mappings[0]);
            }
        }
Ejemplo n.º 15
0
        public void ValueInterning()
        {
            var x = Atom.Encode("abc");
            var y = Atom.Encode("abc");
            var z = new Atom(x.ID);

            Aver.AreEqual(x, y);
            Aver.AreEqual(x, z);

            Aver.AreEqual("abc", x.Value);
            Aver.AreEqual("abc", y.Value);
            Aver.AreEqual("abc", z.Value);

            Aver.AreNotSameRef("abc", x.Value);
            Aver.AreSameRef(x.Value, y.Value);
            Aver.AreSameRef(x.Value, z.Value);
        }
Ejemplo n.º 16
0
        public void T06_CovariantCyclicArrays()
        {
            using (var ms = new MemoryStream())
            {
                var s = new SlimSerializer();

                var dIn = new C8();
                dIn.FObjs = new object[] { null, (object)dIn, (IC8)dIn, (C8_1)dIn, dIn };

                s.Serialize(ms, dIn);
                ms.Seek(0, SeekOrigin.Begin);

                var dOut = (C8)s.Deserialize(ms);

                Aver.IsNull(dOut.FObjs[0]);
                Aver.AreSameRef(dOut, dOut.FObjs[1]);
                Aver.AreSameRef(dOut, dOut.FObjs[2]);
                Aver.AreSameRef(dOut, dOut.FObjs[3]);
            }
        }
Ejemplo n.º 17
0
        public void DefaultMappings_Generic()
        {
            using (var app = new AzosApplication(null, null))
            {
                var maps = app.GetContentTypeMappings();
                Aver.IsNotNull(maps);

                Aver.IsNull(maps["cracks-pacs-facs"]);

                var map = maps.MapFileExtension("cracks-pacs-facs");
                Aver.IsNotNull(map);
                Aver.IsTrue(map.IsGeneric);
                Aver.IsTrue(map.IsBinary);
                Aver.IsFalse(map.IsText);
                Aver.IsFalse(map.IsImage);
                Aver.IsNotNull(map.Metadata);
                Aver.IsFalse(map.Metadata.Exists);

                Aver.AreSameRef(ContentType.Mapping.GENERIC_BINARY, map);
            }
        }
Ejemplo n.º 18
0
        public void T04_CyclicReference()
        {
            using (var ms = new MemoryStream())
            {
                var s = new SlimSerializer();

                var c6  = new C6();
                var dIn = new C5()
                {
                    FC6 = c6
                };
                c6.FC5 = dIn;

                s.Serialize(ms, dIn);
                ms.Seek(0, SeekOrigin.Begin);

                var dOut = (C5)s.Deserialize(ms);

                Aver.AreSameRef(dOut, dOut.FC6.FC5);
            }
        }
Ejemplo n.º 19
0
        public void TypedDoc_1()
        {
            var schema = Schema.GetForTypedDoc <Doc1>();
            var a      = schema["Field1"][null];

            Aver.IsTrue(a.HasValueList);
            var vl1 = a.ParseValueList();
            var vl2 = a.ParseValueList();
            var vl3 = a.ParseValueList(true);
            var vl4 = a.ParseValueList(true);

            Aver.AreSameRef(vl1, vl2);
            Aver.AreNotSameRef(vl1, vl3);
            Aver.AreSameRef(vl3, vl4);
            Aver.AreEqual(4, vl1.Count);

            Aver.AreEqual("apple", vl1["a"].AsString());
            Aver.AreEqual("banana", vl1["b"].AsString());
            Aver.AreEqual("cherry", vl1["c"].AsString());
            Aver.AreEqual("dynamo", vl1["d"].AsString());
            Aver.AreEqual("dynamo", vl1["D"].AsString());//case insensitive
        }
Ejemplo n.º 20
0
        public void DefaultMappings_htm_multiple_exts()
        {
            using (var app = new AzosApplication(null, null))
            {
                var maps = app.GetContentTypeMappings();
                Aver.IsNotNull(maps);

                var map1 = maps.MapFileExtension("htm");
                Aver.IsNotNull(map1);
                Aver.IsFalse(map1.IsGeneric);
                Aver.IsFalse(map1.IsBinary);
                Aver.IsTrue(map1.IsText);
                Aver.IsFalse(map1.IsImage);
                Aver.AreEqual("text/html", map1.ContentType);
                Aver.IsNotNull(map1.Metadata);
                Aver.IsFalse(map1.Metadata.Exists);

                var map2 = maps.MapFileExtension("html");
                Aver.IsNotNull(map2);
                Aver.AreSameRef(map1, map2);
            }
        }
Ejemplo n.º 21
0
        public async Task Test003_ExecuteBlockAsync()
        {
            //---- 1st host
            var start = Guid.NewGuid();
            var flow  = DistributedCallFlow.Start(NOPApplication.Instance, "Flow A", start, "Ryazanov", callerPort: "TV");

            //later in flow....
            await DistributedCallFlow.ExecuteBlockAsync(NOPApplication.Instance, (innerFlow) => {
                innerFlow.See();

                innerFlow.ToHeaderValue().See();

                Aver.AreSameRef(innerFlow, ExecutionContext.CallFlow);

                Aver.AreEqual(start, flow.ID);
                Aver.AreEqual(start, innerFlow.ID);
                Aver.AreEqual("TV", flow.CallerPort);
                Aver.AreEqual("TV", innerFlow.CallerPort);

                Aver.AreEqual("Ryazanov", flow.DirectorName);
                Aver.AreEqual("Ryazanov", innerFlow.DirectorName);

                Aver.AreEqual(2, innerFlow.Count);

                Aver.AreEqual("Ryazanov", innerFlow[0].DirectorName);
                Aver.AreEqual("Dovzhenko", innerFlow[1].DirectorName);

                Aver.AreSameRef(innerFlow[0], innerFlow.EntryPoint);
                Aver.AreSameRef(innerFlow[1], innerFlow.Current);

                Aver.AreEqual(start, innerFlow.EntryPoint.ID);
                Aver.AreNotEqual(start, innerFlow.Current.ID);

                return(Task.FromResult(0));
            }, "Continuation", directorName : "Dovzhenko", callerAgent : "mytezt003");//, callerPort: "VCR");

            Aver.AreSameRef(flow, ExecutionContext.CallFlow);
        }
Ejemplo n.º 22
0
        public void Test_Arow()
        {
            var msg    = withError();
            var writer = SlimFormat.Instance.MakeWritingStreamer();
            var reader = SlimFormat.Instance.MakeReadingStreamer();

            using (var ms = new MemoryStream())
            {
                writer.BindStream(ms);
                reader.BindStream(ms);

                ArowSerializer.Serialize(msg, writer);
                ms.Position = 0;

                var got = new Message();
                ArowSerializer.Deserialize(got, reader);

                got.ToJson(JsonWritingOptions.PrettyPrintRowsAsMap).See();

                Aver.AreEqual(msg.Gdid, got.Gdid);
                Aver.AreEqual(msg.Guid, got.Guid);
                Aver.AreEqual(msg.RelatedTo, got.RelatedTo);
                Aver.AreEqual(msg.Text, got.Text);
                Aver.AreEqual(msg.App, got.App);
                Aver.AreEqual(msg.Channel, got.Channel);
                Aver.AreEqual(msg.ArchiveDimensions, got.ArchiveDimensions);
                Aver.AreEqual(msg.Topic, got.Topic);
                Aver.AreEqual(msg.From, got.From);
                Aver.AreEqual(msg.Parameters, got.Parameters);

                Aver.IsNotNull(got.ExceptionData);
                Aver.AreSameRef(got.ExceptionData, ((WrappedException)got.Exception).Wrapped);

                Aver.AreEqual("Azos.AzosException", got.ExceptionData.TypeName);
                Aver.AreEqual("System.Exception", got.ExceptionData.InnerException.InnerException.InnerException.TypeName);
            }
        }
Ejemplo n.º 23
0
        public void Test_FullCycle()
        {
            var d = new Tezt
            {
                C1 = "{r: {a:1, b:2}}",
                C2 = "{r: {a:-1, b:-2}}"
            };

            var json = JsonWriter.Write(d, JsonWritingOptions.PrettyPrintRowsAsMap);

            json.See();

            var got = JsonReader.ToDoc <Tezt>(json);

            var n1 = got.C1.Node;

            Aver.AreEqual(1, got.C1.Node.Of("a").ValueAsInt());
            Aver.AreEqual(2, got.C1.Node.Of("b").ValueAsInt());
            Aver.AreSameRef(n1, got.C1.Node);

            got.C1.Content = "{r: {a:10, b:20}}";
            var n2 = got.C1.Node;

            Aver.AreNotSameRef(n1, n2);
            Aver.AreSameRef(n2, got.C1.Node);

            got.C1.Node = "r{z=900}".AsLaconicConfig();
            var n3 = got.C1.Node;

            Aver.AreNotSameRef(n2, n3);
            Aver.AreEqual(900, got.C1.Node.Of("z").ValueAsInt());

            Aver.AreEqual(-1, got.C2.Node.Of("a").ValueAsInt());
            Aver.AreEqual(-2, got.C2.Node.Of("b").ValueAsInt());

            got.See();
        }
Ejemplo n.º 24
0
        public void T02_FieldsWithSameInstance()
        {
            using (var ms = new MemoryStream())
            {
                var s = new SlimSerializer();

                var c3 = new C3()
                {
                    Fint1 = 137
                };

                var dIn = new C2 {
                    FObj1 = c3, FI11 = c3, FC31 = c3
                };

                s.Serialize(ms, dIn);
                ms.Seek(0, SeekOrigin.Begin);

                var dOut = (C2)s.Deserialize(ms);

                Aver.AreSameRef(dOut.FObj1, dOut.FI11);
                Aver.AreSameRef(dOut.FObj1, dOut.FC31);
            }
        }
Ejemplo n.º 25
0
 public void TestB()
 {
     Aver.AreSameRef(this, m_ModuleB);
     Aver.AreEqual("value456789", this.ValueB);
 }
Ejemplo n.º 26
0
 public void AssertInjectionCorrectness(IApplication app, Dictionary <string, string> dict)
 {
     base.AssertInjectionCorrectness(app);
     Aver.AreSameRef(dict, m_MySingleton1);
     Aver.AreSameRef(dict, m_MySingleton2);
 }