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); }
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); }
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()); }
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); }
public IEnumerable <Owner> GetAll() { var retorno = (_service.GetAll()); return(retorno); // retorna todos os registros }
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"); } }
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); }
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); } }
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}"); }
public EmployeeWindow(OwnerService service) { InitializeComponent(); this.service = service; Employees.ItemsSource = service.GetAll <Employee>().Select(e => e.Phone); }
public ProfitWindow(OwnerService service) { InitializeComponent(); this.service = service; ProfitListBox.ItemsSource = service.GetAll <Transaction>().Select(i => i.Id); }
public FeedbackWindow(OwnerService service) { InitializeComponent(); this.service = service; FeedbackListBox.ItemsSource = service.GetAll <FeedBack>().Select(f => f.UsersFeedBack); }
public IngredientWindow(OwnerService service) { InitializeComponent(); this.service = service; IngredientsListBox.ItemsSource = service.GetAll <Ingredient>().Select(s => s.Name); }