Ejemplo n.º 1
0
        public void Smoke()
        {
            using (var context = CreateMethodContext())
            {
                // Create base instance
                var baseSample = new BaseSample();
                baseSample.RecordName  = "Smoke";
                baseSample.RecordIndex = 1;
                context.SaveOne(baseSample);

                // Invoke viewers
                baseSample.DefaultNamedViewer();
                baseSample.CustomNamedViewer();

                // Check for the results
                var defaultNamedView = context
                                       .Load(new ViewKey {
                    RecordId = baseSample.Id, ViewName = "DefaultNamedViewer"
                })
                                       .CastTo <ViewSample>();
                context.Log.Verify(defaultNamedView.SampleViewString);
                var customNamedView = context
                                      .Load(new ViewKey {
                    RecordId = baseSample.Id, ViewName = "CustomName"
                })
                                      .CastTo <ViewSample>();
                context.Log.Verify(customNamedView.SampleViewString);
            }
        }
Ejemplo n.º 2
0
        /// <summary>Save record with minimal data for testing how the records are found.</summary>
        private TemporalId SaveMinimalRecord(Context context, string dataSetName, string recordName, int recordIndex, int?version = null)
        {
            var rec = new BaseSample();

            rec.RecordName  = recordName;
            rec.RecordIndex = recordIndex;
            rec.Version     = version;

            var dataSet = context.GetDataSet(dataSetName);

            context.SaveOne(rec, dataSet);

            return(rec.Id);
        }
Ejemplo n.º 3
0
        /// <summary>Save base record.</summary>
        private TemporalId SaveBaseRecord(Context context, string dataSetName, string recordName, int recordIndex)
        {
            var rec = new BaseSample();

            rec.RecordName           = recordName;
            rec.RecordIndex          = recordIndex;
            rec.DoubleElement        = 100.0;
            rec.LocalDateElement     = new LocalDate(2003, 5, 1);
            rec.LocalTimeElement     = new LocalTime(10, 15, 30);                                         // 10:15:30
            rec.LocalMinuteElement   = new LocalMinute(10, 15);                                           // 10:15
            rec.LocalDateTimeElement = new LocalDateTime(2003, 5, 1, 10, 15);                             // 2003-05-01T10:15:
            rec.InstantElement       = new LocalDateTime(2003, 5, 1, 10, 15).ToInstant(DateTimeZone.Utc); // 2003-05-01T10:15:00
            rec.EnumValue            = SampleEnum.EnumValue2;

            var dataSet = context.GetDataSet(dataSetName);

            context.SaveOne(rec, dataSet);
            return(rec.Id);
        }
Ejemplo n.º 4
0
        public void InProcess()
        {
            using (var context = new UnitTestContext(this))
            {
                // Create base instance
                var baseSample = new BaseSample();
                baseSample.RecordName  = "InProcess";
                baseSample.RecordIndex = 1;
                baseSample.Init(context);

                // Invoke handlers of the base class
                baseSample.NonVirtualBaseHandler();
                baseSample.VirtualBaseHandler();

                // Create derived instance
                var derivedSample = new DerivedSample();
                derivedSample.Init(context);

                // Invoke handlers of the derived class
                derivedSample.NonVirtualDerivedHandler();
                derivedSample.VirtualBaseHandler();
            }
        }