public static void ReportingPeriodModelWrapper_without_nulls___Should_serialize_to_string_representation_of_ReportingPeriod___When_using_ReportingPeriodStringSerializerBackedJsonConverter()
        {
            // Arrange
            var model = TestModels.GetDummyReportingPeriodModelWrapper();

            var expected =
                "\"" + nameof(model.UnitOfTime) + "\":\"" + model.UnitOfTime.SerializeToString() + "\"," +
                "\"" + nameof(model.CalendarUnitOfTime) + "\":\"" + model.CalendarUnitOfTime.SerializeToString() + "\"," +
                "\"" + nameof(model.CalendarDay) + "\":\"" + model.CalendarDay.SerializeToString() + "\"," +
                "\"" + nameof(model.CalendarMonth) + "\":\"" + model.CalendarMonth.SerializeToString() + "\"," +
                "\"" + nameof(model.CalendarQuarter) + "\":\"" + model.CalendarQuarter.SerializeToString() + "\"," +
                "\"" + nameof(model.CalendarYear) + "\":\"" + model.CalendarYear.SerializeToString() + "\"," +
                "\"" + nameof(model.CalendarUnbounded) + "\":\"" + model.CalendarUnbounded.SerializeToString() + "\"," +
                "\"" + nameof(model.FiscalUnitOfTime) + "\":\"" + model.FiscalUnitOfTime.SerializeToString() + "\"," +
                "\"" + nameof(model.FiscalMonth) + "\":\"" + model.FiscalMonth.SerializeToString() + "\"," +
                "\"" + nameof(model.FiscalQuarter) + "\":\"" + model.FiscalQuarter.SerializeToString() + "\"," +
                "\"" + nameof(model.FiscalYear) + "\":\"" + model.FiscalYear.SerializeToString() + "\"," +
                "\"" + nameof(model.FiscalUnbounded) + "\":\"" + model.FiscalUnbounded.SerializeToString() + "\"," +
                "\"" + nameof(model.GenericUnitOfTime) + "\":\"" + model.GenericUnitOfTime.SerializeToString() + "\"," +
                "\"" + nameof(model.GenericMonth) + "\":\"" + model.GenericMonth.SerializeToString() + "\"," +
                "\"" + nameof(model.GenericQuarter) + "\":\"" + model.GenericQuarter.SerializeToString() + "\"," +
                "\"" + nameof(model.GenericYear) + "\":\"" + model.GenericYear.SerializeToString() + "\"," +
                "\"" + nameof(model.GenericUnbounded) + "\":\"" + model.GenericUnbounded.SerializeToString() + "\"}";

            // Act
            var actual = JsonConvert.SerializeObject(model);

            // Assert
            actual.AsTest().Must().ContainString(expected);
        }
Ejemplo n.º 2
0
        public static void ReportingPeriodModelWrapper_without_nulls___Should_serialize_to_ReportingPeriodPersistenceModel_representation_of_ReportingPeriod___When_using_ReportingPeriodBsonSerializer()
        {
            // Arrange
            var model = TestModels.GetDummyReportingPeriodModelWrapper();

            var expected =
                "\"" + nameof(model.UnitOfTime) + "\" : { \"Start\" : \"" + model.UnitOfTime.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.UnitOfTime.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.CalendarUnitOfTime) + "\" : { \"Start\" : \"" + model.CalendarUnitOfTime.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.CalendarUnitOfTime.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.CalendarDay) + "\" : { \"Start\" : \"" + model.CalendarDay.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.CalendarDay.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.CalendarMonth) + "\" : { \"Start\" : \"" + model.CalendarMonth.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.CalendarMonth.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.CalendarQuarter) + "\" : { \"Start\" : \"" + model.CalendarQuarter.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.CalendarQuarter.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.CalendarYear) + "\" : { \"Start\" : \"" + model.CalendarYear.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.CalendarYear.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.CalendarUnbounded) + "\" : { \"Start\" : \"" + model.CalendarUnbounded.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.CalendarUnbounded.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.FiscalUnitOfTime) + "\" : { \"Start\" : \"" + model.FiscalUnitOfTime.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.FiscalUnitOfTime.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.FiscalMonth) + "\" : { \"Start\" : \"" + model.FiscalMonth.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.FiscalMonth.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.FiscalQuarter) + "\" : { \"Start\" : \"" + model.FiscalQuarter.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.FiscalQuarter.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.FiscalYear) + "\" : { \"Start\" : \"" + model.FiscalYear.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.FiscalYear.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.FiscalUnbounded) + "\" : { \"Start\" : \"" + model.FiscalUnbounded.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.FiscalUnbounded.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.GenericUnitOfTime) + "\" : { \"Start\" : \"" + model.GenericUnitOfTime.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.GenericUnitOfTime.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.GenericMonth) + "\" : { \"Start\" : \"" + model.GenericMonth.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.GenericMonth.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.GenericQuarter) + "\" : { \"Start\" : \"" + model.GenericQuarter.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.GenericQuarter.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.GenericYear) + "\" : { \"Start\" : \"" + model.GenericYear.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.GenericYear.End.SerializeToSortableString() + "\" }, " +
                "\"" + nameof(model.GenericUnbounded) + "\" : { \"Start\" : \"" + model.GenericUnbounded.Start.SerializeToSortableString() + "\", \"End\" : \"" + model.GenericUnbounded.End.SerializeToSortableString() + "\" }";

            // Act
            var actual = model.ToJson();

            // Assert
            actual.AsTest().Must().ContainString(expected);
        }
        public static void ReportingPeriodModelWrapper_without_nulls___Should_serialize_to_string_representation_of_ReportingPeriod___When_using_ReportingPeriodStringSerializer()
        {
            // Arrange
            var model = TestModels.GetDummyReportingPeriodModelWrapper();

            var expected =
                nameof(model.CalendarDay) + "=" + model.CalendarDay.SerializeToString() + Environment.NewLine +
                nameof(model.CalendarMonth) + "=" + model.CalendarMonth.SerializeToString() + Environment.NewLine +
                nameof(model.CalendarQuarter) + "=" + model.CalendarQuarter.SerializeToString() + Environment.NewLine +
                nameof(model.CalendarUnbounded) + "=" + model.CalendarUnbounded.SerializeToString() + Environment.NewLine +
                nameof(model.CalendarUnitOfTime) + "=" + model.CalendarUnitOfTime.SerializeToString() + Environment.NewLine +
                nameof(model.CalendarYear) + "=" + model.CalendarYear.SerializeToString() + Environment.NewLine +
                nameof(model.FiscalMonth) + "=" + model.FiscalMonth.SerializeToString() + Environment.NewLine +
                nameof(model.FiscalQuarter) + "=" + model.FiscalQuarter.SerializeToString() + Environment.NewLine +
                nameof(model.FiscalUnbounded) + "=" + model.FiscalUnbounded.SerializeToString() + Environment.NewLine +
                nameof(model.FiscalUnitOfTime) + "=" + model.FiscalUnitOfTime.SerializeToString() + Environment.NewLine +
                nameof(model.FiscalYear) + "=" + model.FiscalYear.SerializeToString() + Environment.NewLine +
                nameof(model.GenericMonth) + "=" + model.GenericMonth.SerializeToString() + Environment.NewLine +
                nameof(model.GenericQuarter) + "=" + model.GenericQuarter.SerializeToString() + Environment.NewLine +
                nameof(model.GenericUnbounded) + "=" + model.GenericUnbounded.SerializeToString() + Environment.NewLine +
                nameof(model.GenericUnitOfTime) + "=" + model.GenericUnitOfTime.SerializeToString() + Environment.NewLine +
                nameof(model.GenericYear) + "=" + model.GenericYear.SerializeToString() + Environment.NewLine +
                nameof(model.UnitOfTime) + "=" + model.UnitOfTime.SerializeToString() + Environment.NewLine;

            // Act
            var actual = PropertyBagSerializer.SerializeToString(model);

            // Assert
            actual.AsTest().Must().ContainString(expected);
        }
        public static void ReportingPeriodModelWrapper_without_nulls___Should_roundtrip_to_json_and_back___When_using_ReportingPeriodStringSerializerBackedJsonConverter()
        {
            // Arrange
            var expected = TestModels.GetDummyReportingPeriodModelWrapper();

            var json = JsonConvert.SerializeObject(expected);

            // Act
            var actual = JsonConvert.DeserializeObject <ReportingPeriodModelWrapper>(json);

            // Assert
            actual.AsTest().Must().BeEqualTo(expected);
        }
Ejemplo n.º 5
0
        public static void ReportingPeriodModelWrapper_without_nulls___Should_roundtrip_to_bson_and_back___When_using_ReportingPeriodBsonSerializer()
        {
            // Arrange
            var expected = TestModels.GetDummyReportingPeriodModelWrapper();

            var bson = expected.ToBsonDocument();

            // Act
            var actual = BsonSerializer.Deserialize <ReportingPeriodModelWrapper>(bson);

            // Assert
            actual.AsTest().Must().BeEqualTo(expected);
        }
        public static void ReportingPeriodModelWrapper_without_nulls___Should_roundtrip_to_property_bag_and_back___When_using_ReportingPeriodStringSerializer()
        {
            // Arrange
            var expected = TestModels.GetDummyReportingPeriodModelWrapper();

            var propertyBag = PropertyBagSerializer.SerializeToString(expected);

            // Act
            var actual = PropertyBagSerializer.Deserialize <ReportingPeriodModelWrapper>(propertyBag);

            // Assert
            actual.AsTest().Must().BeEqualTo(expected);
        }