예제 #1
0
        public void Index_NoRecordsFound_ListShouldBeEmpty()
        {
            //arrange
            var owners = RepoMocks.RepositoryMocks.FakeOwnersList();// get some data


            //mockOwnerRepository.Setup(repo => repo.GetAll).Returns(owners);

            var results = service.GetAll();

            //assert
            Assert.IsTrue(results.ToList().Count() == 0);
        }
예제 #2
0
        public async Task OwnereListByGender_SortMalePetsOrderName_True()
        {
            // Arrange
            // See Constructor/Setup above

            IOwnerService ownerService = new OwnerService(_loggerMock.Object,
                                                          _urlHelper.Object,
                                                          _httpClientMock,
                                                          _deserializer.Object,
                                                          _repositoryOwner,
                                                          _sortOwner);
            var listGenderSorted = await ownerService.GetAll();

            // Act
            var ownerGroupByGender = _sortOwner.SortGroupByPetType(listGenderSorted[1]);

            // Assert
            foreach (var pet in ownerGroupByGender)
            {
                Assert.Equal("Cat", pet.Type);
            }

            var malePetFirst  = ownerGroupByGender.First();
            var malePetSecond = ownerGroupByGender.Skip(1).First();

            Assert.Equal("Garfield", malePetFirst.Name);
            Assert.Equal("Jim", malePetSecond.Name);
        }
예제 #3
0
        public async Task OwnerService_RetrieveAllList_True()
        {
            // Arrange
            // See Constructor/Setup above

            IOwnerService ownerService = new OwnerService(_loggerMock.Object,
                                                          _urlHelper.Object,
                                                          _httpClientMock,
                                                          _deserializer.Object,
                                                          _repositoryOwner,
                                                          _sortOwner);

            // Act
            var list = await ownerService.GetAll();

            // Assert
            Assert.NotNull(list);
            Assert.True(list.Count > 0);
            Assert.NotNull(list[0]);
            Assert.NotNull(list[1]);

            Assert.Equal("Female", list[0].Key);
            Assert.Equal("Male", list[1].Key);

            Assert.Equal(3, list[0].Count());
            Assert.Equal(2, list[1].Count());
        }
예제 #4
0
        private void ReadButton_Click(object sender, RoutedEventArgs e)
        {
            var feedback = service.GetAll <FeedBack>().Find(f => f.UsersFeedBack == FeedbackListBox.SelectedItem.ToString());

            feedback.Seen = true;
            service.Update(feedback);
        }
예제 #5
0
        public IEnumerable <Owner> GetAll()
        {
            var retorno = (_service.GetAll());

            return(retorno);

            // retorna todos os registros
        }
예제 #6
0
 private void ViewInfoButton_Click(object sender, RoutedEventArgs e)
 {
     if (IngredientsListBox.SelectedItem != null)
     {
         var ingredient = service.GetAll <Ingredient>().First(i => i.Name == IngredientsListBox.SelectedItem.ToString());
         MessageBox.Show($"Quantity of {ingredient.Name} in storage : {ingredient.QuantityInStorage} {ingredient.Measurement}s");
     }
 }
예제 #7
0
        public void Get_All_Owners()
        {
            var ownerContextMock = new Mock <IDatabaseService>();

            ownerContextMock.Setup(m => m.Owners).Returns(ownerMock.Object);
            var ownerService = new OwnerService(ownerContextMock.Object);
            var owners       = ownerService.GetAll();

            Assert.IsTrue(owners.Count == 6);
        }
예제 #8
0
        public async Task OwnereListByGender_SortFemalePets_True()
        {
            // Arrange
            // See Constructor/Setup above

            IOwnerService ownerService = new OwnerService(_loggerMock.Object,
                                                          _urlHelper.Object,
                                                          _httpClientMock,
                                                          _deserializer.Object,
                                                          _repositoryOwner,
                                                          _sortOwner);
            var listGenderSorted = await ownerService.GetAll();

            // Act
            var ownerGroupByGender = _sortOwner.SortGroupByPetType(listGenderSorted[0]);

            // Assert
            foreach (var pet in ownerGroupByGender)
            {
                Assert.Equal("Cat", pet.Type);
            }
        }
예제 #9
0
        private void Employees_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var employee = service.GetAll <Employee>().Find(e => e.Phone == Employees.SelectedItem.ToString());

            MessageBox.Show($"Name: {employee.Name}, Phone: {employee.Phone}, Position: {employee.Position}");
        }
예제 #10
0
 public EmployeeWindow(OwnerService service)
 {
     InitializeComponent();
     this.service          = service;
     Employees.ItemsSource = service.GetAll <Employee>().Select(e => e.Phone);
 }
예제 #11
0
 public ProfitWindow(OwnerService service)
 {
     InitializeComponent();
     this.service = service;
     ProfitListBox.ItemsSource = service.GetAll <Transaction>().Select(i => i.Id);
 }
예제 #12
0
 public FeedbackWindow(OwnerService service)
 {
     InitializeComponent();
     this.service = service;
     FeedbackListBox.ItemsSource = service.GetAll <FeedBack>().Select(f => f.UsersFeedBack);
 }
예제 #13
0
 public IngredientWindow(OwnerService service)
 {
     InitializeComponent();
     this.service = service;
     IngredientsListBox.ItemsSource = service.GetAll <Ingredient>().Select(s => s.Name);
 }