コード例 #1
0
        public virtual void SerializeToUtf8Bytes_Should_ReturnUtf8BytesOfGenericInstancePassedIn()
        {
            // Arrange
            var testDto = new ADto
            {
                RedPanda = "Hello World!",
                Happy    = true,
                Year     = 2020,
                Enum     = TestEnum.RedPanda,
                BDto     = new BDto
                {
                    Service = "RedPanda"
                }
            };
            var expectedResult = Encoding.UTF8.GetBytes("{\"RedPanda\":\"Hello World!\",\"Happy\":true,\"Year\":2020,\"Enum\":0,\"BDto\":{\"Service\":\"RedPanda\"}}");

            // Assert
            var actualResult = jsonProvider.SerializeToUtf8Bytes(testDto);

            // Act
            actualResult.Should().BeEquivalentTo(expectedResult);
        }