Esempio n. 1
0
        public void UnconfirmModelWillThrow()
        {
            int recordId = SaveRecord(MetricsRecords.NewRecord().MarkAsNew());

            Assert.That(recordId, Is.GreaterThan(1000));

            Assert.That(Records, Is.Not.Empty);

            SimpleMetricsModel model = Repository.FindById(recordId);

            Assert.That(model, Is.Not.Null);
            Assert.That(model.Location, Is.EqualTo(location));

            model.TotalTonnes += 100;

            InvalidOperationException exception = Assert.Throws <InvalidOperationException>(() => Repository.Unconfirm(model));

            Assert.That(exception.Message, Is.StringContaining("'UnconfirmRecord'"));
        }
Esempio n. 2
0
        public void Get()
        {
            DateTime before = DateTime.Today.AddMinutes(-1);
            DateTime after  = DateTime.Today.AddMinutes(+1);

            int recordId = SaveRecord(MetricsRecords.NewRecord().MarkAsNew());

            Assert.That(recordId, Is.GreaterThan(1000));

            Assert.That(Records, Is.Not.Empty);

            SimpleMetricsModel model = Repository.FindById(recordId);

            Assert.That(model, Is.Not.Null);

            Assert.That(model.Location, Is.EqualTo(location));
            Assert.That(model.StartTime, Is.GreaterThan(before).And.LessThan(after));
            Assert.That(model.Duration, Is.EqualTo(60 * 60));
        }