Ejemplo n.º 1
0
        public void TestingStrings(string init, Encoding encoding)
        {
            ResetBois();

            PrimitiveWriter.WriteValue(Writer, init, encoding);
            ResetStream();

            var final = PrimitiveReader.ReadString(Reader, encoding);

            final.Should().Be(init);
        }
Ejemplo n.º 2
0
        public void TestingGuidNullable(Guid?init)
        {
            ResetBois();

            PrimitiveWriter.WriteValue(Writer, init);
            ResetStream();

            var final = PrimitiveReader.ReadGuidNullable(Reader);

            final.Should().Be(init);
        }
Ejemplo n.º 3
0
        public void TestingDBNull(DBNull init)
        {
            ResetBois();

            PrimitiveWriter.WriteValue(Writer, init);
            ResetStream();

            var final = PrimitiveReader.ReadDbNull(Reader);

            final.Should().Be(init);
        }
Ejemplo n.º 4
0
        public void TestingColorNullable(Color?init)
        {
            ResetBois();

            PrimitiveWriter.WriteValue(Writer, init);
            ResetStream();

            var final = PrimitiveReader.ReadColorNullable(Reader);

            Assert.True(init?.ToArgb() == final?.ToArgb(), $"Color value are not same, expected: {init?.ToArgb()}, actual: {final?.ToArgb()}");

            // saving name and compare against it is pointless
            //final.Should().BeEquivalentTo(init, because: "The colors name are not same");
        }
Ejemplo n.º 5
0
        public void TestingEnum(Enum init, Type enumType)
        {
            ResetBois();

            if (init != null)
            {
                enumType = init.GetType();
            }

            PrimitiveWriter.WriteValue(Writer, init);
            ResetStream();

            var final = PrimitiveReader.ReadEnum(Reader, enumType);

            final.Should().Be(init);
        }
Ejemplo n.º 6
0
        public void TestingByteArray(byte[] init)
        {
            ResetBois();

            PrimitiveWriter.WriteValue(Writer, init);
            ResetStream();

            var final = PrimitiveReader.ReadByteArray(Reader);

            if (final != null && init != null)
            {
                final.Should().BeEquivalentTo(init);
            }
            else
            {
                Assert.True(init == final);
            }
        }