Ejemplo n.º 1
0
        /// <summary>
        /// Handles the Click event of the CloseButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void CloseButtonClick(object sender, System.EventArgs e)
        {
            BillDTO bill = CheckOutServices.Close();

            EnableCheckOutControls(false);
            Display(bill);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Click event of the ScanButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void ScanButtonClick(object sender, System.EventArgs e)
        {
            CheckOutServices.Scan((long)CodeNumericUpDown.Value);

            CodeNumericUpDown.Value = 0;
            CodeNumericUpDown.Focus();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the Click event of the StartButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void StartButtonClick(object sender, System.EventArgs e)
        {
            EnableCheckOutControls(true);
            CodeNumericUpDown.Focus();

            CheckOutServices.Start();
        }
        public void Close_ShouldReturnZeroBill_WhenNothingScanned()
        {
            // Arrange
            CheckOutServices.Start();

            // Act
            var bill = CheckOutServices.Close();

            // Assert
            bill.Should().NotBeNull();
            bill.TotalPrice.Should().Be(0);
        }
        public void Close_ShouldReturnPositiveBill_WhenSomethingScanned()
        {
            // Arrange
            CheckOutServices.Start();
            CheckOutServices.Scan(12345678);

            // Act
            var bill = CheckOutServices.Close();

            // Assert
            bill.Should().NotBeNull();
            bill.TotalPrice.Should().BePositive();
        }
Ejemplo n.º 6
0
        public void Should_Add_New_CheckOut_and_Calls_SaveChanges()
        {
            var options = new DbContextOptionsBuilder <LibraryDBContext>().UseSqlServer("Add_writes_to_database")
                          .Options;

            using (var context = new LibraryDBContext(options))
            {
                var service = new CheckOutServices(context);

                service.Add(new Checkouts
                {
                    Id = -247
                });

                Assert.Equal(247, context.Checkouts.Single().Id);
            }
        }