public void WriteInt32Test()
        {
            // arrange
            int value;

            byte[]         expected;
            byte[]         actual;
            FakeSerializer target;

            value    = 62220164;
            expected = new[]
            {
                (byte)3,
                (byte)181,
                (byte)103,
                (byte)132
            };
            target = new FakeSerializer();

            // act
            using (MemoryStream stream = new MemoryStream())
            {
                target.WriteInt32(stream, value);
                actual = stream.ToArray();
            }

            // assert
            actual.Should().Equal(expected);
        }
        public void WriteInt16Test()
        {
            // arrange
            short value;

            byte[]         expected;
            byte[]         actual;
            FakeSerializer target;

            value    = 31529;
            expected = new[]
            {
                (byte)123,
                (byte)41
            };
            target = new FakeSerializer();

            // act
            using (MemoryStream stream = new MemoryStream())
            {
                target.WriteInt16(stream, value);
                actual = stream.ToArray();
            }

            // assert
            actual.Should().Equal(expected);
        }
    public void ReadInt16Test()
    {
      // arrange
      int expected;
      int actual;
      MemoryStream stream;
      FakeSerializer target;

      stream = new MemoryStream(new byte[]
                                {
                                  123, 41
                                });
      target = new FakeSerializer();
      expected = 31529;

      // act
      actual = target.ReadInt16(stream);

      // assert
      expected.Should().Be(actual);
    }
Пример #4
0
        public void ReadInt32Test()
        {
            // arrange
            int            expected;
            int            actual;
            MemoryStream   stream;
            FakeSerializer target;

            stream = new MemoryStream(new byte[]
            {
                3, 181, 103, 132
            });
            target   = new FakeSerializer();
            expected = 62220164;

            // act
            actual = target.ReadInt32(stream);

            // assert
            expected.Should().Be(actual);
        }
Пример #5
0
        public void ReadInt16Test()
        {
            // arrange
            int            expected;
            int            actual;
            MemoryStream   stream;
            FakeSerializer target;

            stream = new MemoryStream(new byte[]
            {
                123, 41
            });
            target   = new FakeSerializer();
            expected = 31529;

            // act
            actual = target.ReadInt16(stream);

            // assert
            expected.Should().Be(actual);
        }
    public void WriteInt16Test()
    {
      // arrange
      short value;
      byte[] expected;
      byte[] actual;
      FakeSerializer target;

      value = 31529;
      expected = new[]
                 {
                   (byte)123, (byte)41
                 };
      target = new FakeSerializer();

      // act
      using (MemoryStream stream = new MemoryStream())
      {
        target.WriteInt16(stream, value);
        actual = stream.ToArray();
      }

      // assert
      actual.Should().Equal(expected);
    }
    public void ReadInt32Test()
    {
      // arrange
      int expected;
      int actual;
      MemoryStream stream;
      FakeSerializer target;

      stream = new MemoryStream(new byte[]
                                {
                                  3, 181, 103, 132
                                });
      target = new FakeSerializer();
      expected = 62220164;

      // act
      actual = target.ReadInt32(stream);

      // assert
      expected.Should().Be(actual);
    }
    public void WriteInt32Test()
    {
      // arrange
      int value;
      byte[] expected;
      byte[] actual;
      FakeSerializer target;

      value = 62220164;
      expected = new[]
                 {
                   (byte)3, (byte)181, (byte)103, (byte)132
                 };
      target = new FakeSerializer();

      // act
      using (MemoryStream stream = new MemoryStream())
      {
        target.WriteInt32(stream, value);
        actual = stream.ToArray();
      }

      // assert
      actual.Should().Equal(expected);
    }