Ejemplo n.º 1
0
            public void Updates_existing_Journal_entry_record_on_success()
            {
                //Arrange
                var journalEntry = TestHelper.CreateObjectGraphAndInsertIntoDatabase <SampleOrderJournalEntry>();
                var parameters   = new SetSampleOrderJournalEntryParameters
                {
                    UserToken       = TestUser.UserName,
                    SampleOrderKey  = journalEntry.ToSampleOrderKey(),
                    JournalEntryKey = journalEntry.ToSampleOrderJournalEntryKey(),
                    Date            = new DateTime(2016, 10, 10),
                    Text            = "AAAAAAAH!"
                };

                //Act
                var result = Service.SetJournalEntry(parameters);

                //Assert
                result.AssertSuccess();
                journalEntry = RVCUnitOfWork.SampleOrderJournalEntryRepository.FindByKey(journalEntry.ToSampleOrderJournalEntryKey(), e => e.Employee);
                parameters.AssertEqual(journalEntry);
            }
Ejemplo n.º 2
0
            public void Creates_new_Journal_entry_record_on_success()
            {
                //Arrange
                var sampleOrder = TestHelper.CreateObjectGraphAndInsertIntoDatabase <SampleOrder>();
                var parameters  = new SetSampleOrderJournalEntryParameters
                {
                    UserToken      = TestUser.UserName,
                    SampleOrderKey = sampleOrder.ToSampleOrderKey(),
                    Date           = new DateTime(2016, 10, 10),
                    Text           = "AAAAAAAH!"
                };

                //Act
                var result = Service.SetJournalEntry(parameters);

                //Assert
                result.AssertSuccess();
                var journalEntry = RVCUnitOfWork.SampleOrderRepository.FindByKey(sampleOrder.ToSampleOrderKey(), s => s.JournalEntries.Select(j => j.Employee))
                                   .JournalEntries.Single();

                parameters.AssertEqual(journalEntry);
            }
Ejemplo n.º 3
0
            public void SetJournalEntry()
            {
                //Arrange
                var sampleOrder = RVCUnitOfWork.SampleOrderRepository
                                  .Filter(i => i.SampleID != null)
                                  .OrderByDescending(i => i.Year)
                                  .FirstOrDefault();

                if (sampleOrder == null)
                {
                    Assert.Inconclusive("No SampleOrderItme to test.");
                }

                var parameters = new SetSampleOrderJournalEntryParameters
                {
                    UserToken      = TestUser.UserName,
                    SampleOrderKey = sampleOrder.ToSampleOrderKey(),
                    Date           = DateTime.Now,
                    Text           = "Today is the first day of the rest of my life."
                };

                //Act
                var result = Service.SetJournalEntry(parameters);

                result.AssertSuccess();

                //Assert
                MockKillSwitch.Verify(k => k.Engage(), Times.Never());

                using (var oldContext = new RioAccessSQLEntities())
                {
                    var note = oldContext.tblSampleNotes
                               .Where(n => n.SampleID == sampleOrder.SampleID)
                               .OrderByDescending(n => n.SamNoteID)
                               .FirstOrDefault();
                    Assert.AreEqual(parameters.Text, note.SampleNote);
                }
            }