コード例 #1
0
        public void DeserializeMultipleWorks()
        {
            Example e = GetTypicalExample();
            OpenGeneric <WFloat> o = new OpenGeneric <WFloat>()
            {
                MyT     = 3.0F,
                MyListT = new List <WFloat>()
                {
                    1.0F,
                    2.0F
                }
            };

            e.SerializeLazinator();
            o.SerializeLazinator();
            int           lengthExample     = (int)e.CloneLazinator().LazinatorMemoryStorage.Length;
            int           lengthOpenGeneric = (int)o.CloneLazinator().LazinatorMemoryStorage.Length;
            int           lengthSoFar       = 0;
            const int     numPairs          = 5;
            Memory <byte> memory            = new Memory <byte>(new byte[numPairs * (lengthExample + lengthOpenGeneric)]);

            for (int i = 0; i < numPairs; i++)
            {
                e.LazinatorMemoryStorage.OnlyMemory.CopyTo(memory.Slice(lengthSoFar));
                lengthSoFar += lengthExample;
                o.LazinatorMemoryStorage.OnlyMemory.CopyTo(memory.Slice(lengthSoFar));
                lengthSoFar += lengthOpenGeneric;
            }
            var results = DeserializationFactory.Instance
                          .CreateMultiple(memory, null)
                          .Select(x => (ILazinator)x)
                          .Where(x => x != null).ToList();

            results.Count().Should().Be(10);
            for (int i = 0; i < numPairs; i++)
            {
                (results[2 * i] as Example).Should().NotBeNull();
                (results[2 * i + 1] as OpenGeneric <WFloat>).Should().NotBeNull();
                (results[2 * i + 1] as OpenGeneric <WInt32>).Should().BeNull();
            }
        }
コード例 #2
0
 public GenService(OpenGeneric <int> dep)
 {
 }
コード例 #3
0
        public void Created_Object_Is_Returned()
        {
            OpenGeneric <Object> created = mSession.Single <OpenGeneric <Object> >().Get();

            Assert.NotNull(created);
        }