예제 #1
0
        public DeletePetType(IPetTypeManager petTypeManager = null)
        {
            _petTypeManager = petTypeManager;
            if (_petTypeManager == null)
            {
                _petTypeManager = new PetTypeManager();
            }

            InitializeComponent();
            try
            {
                if (cboPetType.Items.Count == 0)
                {
                    var petTypeID = _petTypeManager.RetrieveAllPetTypes();
                    foreach (var item in petTypeID)
                    {
                        cboPetType.Items.Add(item);
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
예제 #2
0
 public void TestSetup()
 {
     accessor   = new PetTypeAccessorMock();
     petManager = new PetTypeManager(accessor);
     petTypes   = new List <PetType>();
     petTypes   = petManager.RetrieveAllPetTypes("all");
 }
예제 #3
0
        public void TestRetrieveAllPetTypes()
        {
            // arrange
            List <PetType> testpets = null;

            // act
            testpets = petManager.RetrieveAllPetTypes("all");
            // assert
            CollectionAssert.Equals(testpets, petTypes);
        }
예제 #4
0
        //  BrowsePetType(IPetTypeManager petTypeManager = null)
        /// <summary>
        /// Method for initializing component retrieves all pet types to itemsSource.        /// </summary>
        /// <param name="IPetTypeManager petTypeManager = null">Provides list of pet types to view.</param>
        /// <returns></returns>
        public BrowsePetType(IPetTypeManager petTypeManager = null)
        {
            _petTypeManager = petTypeManager;
            if (_petTypeManager == null)
            {
                _petTypeManager = new PetTypeManager();
            }
            InitializeComponent();
            try
            {
                _petType = _petTypeManager.RetrieveAllPetTypes("All");
                if (_currentPetType == null)
                {
                    _currentPetType = _petType;
                }
                dgPetTypes.ItemsSource = _currentPetType;
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }