예제 #1
0
        public static DateProjection FromDto(DateProjectionDto dto)
        {
            var retVal = new DateProjection();

            retVal.UpdateFromDto(dto);
            return(retVal);
        }
예제 #2
0
        public static DateProjectionDto ToDto(DateProjection model)
        {
            var retVal = new DateProjectionDto();

            model.UpdateDto(retVal);
            return(retVal);
        }
예제 #3
0
 public void UpdateFromDto(DateProjectionDto dto)
 {
     this.ProjectionType  = dto.ProjectionType;
     this.PeriodCount     = dto.PeriodCount;
     this.DayOfMonth      = dto.DayOfMonth;
     this.WeeksInMonth    = dto.WeeksInMonth;
     this.Month           = dto.Month;
     this.DaysOfWeekExt   = dto.DaysOfWeekExt;
     this.DaysOfWeekFlags = dto.DaysOfWeekFlags;
 }
예제 #4
0
 public void UpdateDto(DateProjectionDto dto)
 {
     dto.ProjectionType  = this.ProjectionType;
     dto.PeriodCount     = this.PeriodCount;
     dto.DayOfMonth      = this.DayOfMonth;
     dto.WeeksInMonth    = this.WeeksInMonth;
     dto.Month           = this.Month;
     dto.DaysOfWeekExt   = this.DaysOfWeekExt;
     dto.DaysOfWeekFlags = this.DaysOfWeekFlags;
 }
        public void DtoAndDomainRoundTrip()
        {
            Fixture fixture = TestHelper.CreateSerializationAutoFixture();

            DateProjectionDto sourceDto = fixture.Create <DateProjectionDto>();
            DateProjection    domain    = DateProjection.FromDto(sourceDto);
            DateProjectionDto targetDto = DateProjection.ToDto(domain);

            var sourceDtoLikeness = sourceDto.AsSource().OfLikeness <DateProjectionDto>();

            sourceDtoLikeness.ShouldEqual(targetDto);
        }
        public void DtoAndLiteDbRoundTrip()
        {
            Fixture fixture = TestHelper.CreateSerializationAutoFixture(useLiteDBCompatibleDateTime: true);

            DateProjectionDto sourceDto = fixture.Create <DateProjectionDto>();
            DateProjectionDto targetDto;

            using (var db = new LiteDatabase(new MemoryStream()))
            {
                var col = db.GetCollection <DateProjectionDto>();
                var id  = col.Insert(sourceDto);
                targetDto = col.FindById(id);
            }

            var sourceDtoLikeness = sourceDto.AsSource().OfLikeness <DateProjectionDto>();

            sourceDtoLikeness.ShouldEqual(targetDto);
        }