Beispiel #1
0
        public static void RawSubject_Roundtrips()
        {
            // Arrange
            var expected = A.Dummy <RawSubject>();

            // Act
            var actualBsonString = BsonSerializer.SerializeToString(expected);
            var actualBson       = BsonSerializer.Deserialize <RawSubject>(actualBsonString);

            var actualJsonString = JsonSerializer.SerializeToString(expected);
            var actualJson       = JsonSerializer.Deserialize <RawSubject>(actualJsonString);

            // Assert
            actualBson.Should().Be(expected);
            actualJson.Should().Be(expected);
        }
        public static void ProcessDetails_Roundtrips()
        {
            // Arrange
            var expected       = A.Dummy <ProcessDetails>();
            var bsonSerializer = new ObcBsonSerializer(typeof(DiagnosticsBsonSerializationConfiguration).ToBsonSerializationConfigurationType());
            var jsonSerializer = new ObcJsonSerializer(typeof(DiagnosticsJsonSerializationConfiguration).ToJsonSerializationConfigurationType());

            // Act
            var actualBsonString = bsonSerializer.SerializeToString(expected);
            var actualBson       = bsonSerializer.Deserialize <ProcessDetails>(actualBsonString);

            var actualJsonString = jsonSerializer.SerializeToString(expected);
            var actualJson       = jsonSerializer.Deserialize <ProcessDetails>(actualJsonString);

            // Assert
            actualBson.Should().Be(expected);
            actualJson.Should().Be(expected);
        }
        public static void Roundtrip_DefaultPropertiesPackageDescription()
        {
            // Arrange
            var expected       = new PackageDescription();
            var bsonSerializer = new ObcBsonSerializer <PackagingBsonSerializationConfiguration>();
            var jsonSerializer = new ObcJsonSerializer <PackagingJsonSerializationConfiguration>();

            // Act
            var actualBsonString     = bsonSerializer.SerializeToString(expected);
            var actualFromBsonString = bsonSerializer.Deserialize <PackageDescription>(actualBsonString);

            var actualJsonString     = jsonSerializer.SerializeToString(expected);
            var actualFromJsonString = jsonSerializer.Deserialize <PackageDescription>(actualJsonString);

            // Assert
            actualFromBsonString.Should().Be(expected);
            actualFromJsonString.Should().Be(expected);
        }
        public static void Roundtrip_DummyPackageRepositoryConfiguration()
        {
            // Arrange
            var expected       = A.Dummy <PackageRepositoryConfiguration>();
            var bsonSerializer = new ObcBsonSerializer <PackagingBsonSerializationConfiguration>();
            var jsonSerializer = new ObcJsonSerializer <PackagingJsonSerializationConfiguration>();

            // Act
            var actualBsonString     = bsonSerializer.SerializeToString(expected);
            var actualFromBsonString = bsonSerializer.Deserialize <PackageRepositoryConfiguration>(actualBsonString);

            var actualJsonString     = jsonSerializer.SerializeToString(expected);
            var actualFromJsonString = jsonSerializer.Deserialize <PackageRepositoryConfiguration>(actualJsonString);

            // Assert
            actualFromBsonString.Should().Be(expected);
            actualFromJsonString.Should().Be(expected);
        }
        public static void Roundtrip_DummyScheduleBase()
        {
            // Arrange
            var expected       = A.Dummy <ScheduleBase>();
            var bsonSerializer = new ObcBsonSerializer <CronBsonSerializationConfiguration>();
            var jsonSerializer = new ObcJsonSerializer <CronJsonSerializationConfiguration>();

            // Act
            var actualBsonString     = bsonSerializer.SerializeToString(expected);
            var actualFromBsonString = bsonSerializer.Deserialize <ScheduleBase>(actualBsonString);

            var actualJsonString     = jsonSerializer.SerializeToString(expected);
            var actualFromJsonString = jsonSerializer.Deserialize <ScheduleBase>(actualJsonString);

            // Assert
            actualFromBsonString.Should().Be(expected);
            actualFromJsonString.Should().Be(expected);
        }