private void Should_SupplierNavigate_Correctly() { /* * _providersControlViewModel = new ProvidersControlViewModel(_configurationService.Object, * _unity.Object, * _dataServices.Object, * _regionManager.Object, * null, * null, * _eventManager.Object); */ _providersControlViewModel.StartAndNotify(); IEnumerable <SupplierSummaryDto> collection = _providersControlViewModel.SummaryView as IEnumerable <SupplierSummaryDto>; Assert.NotNull(collection); Assert.GreaterOrEqual(collection.Count(), 1); // from the view comes an openitem. SupplierSummaryDto dto = collection.FirstOrDefault(); string tabName = dto.Codigo + "." + dto.Nombre; var navigationParameters = new NavigationParameters(); navigationParameters.Add("supplierId", dto.Codigo); navigationParameters.Add(ScopedRegionNavigationContentLoader.DefaultViewName, tabName); var uri = new Uri(typeof(ProviderInfoView).FullName + navigationParameters, UriKind.Relative); _regionManager.Verify(manager => manager.RequestNavigate("TabRegion", tabName), Times.AtMostOnce); Assert.NotNull(collection); _providersControlViewModel.OpenItem.Execute(dto); }
public async Task Should_Update_SupplierBranches() { // arrange var suppliers = await _supplierDataServices.GetSupplierAsyncSummaryDo(); SupplierSummaryDto supplierSummaryDto = suppliers.FirstOrDefault(); if (supplierSummaryDto != null) { var id = supplierSummaryDto.Codigo; var province = new ProvinciaDto(); province.Name = "Barcelona"; province.Code = "08"; province.Country = "Spain"; Random rand = new Random(); var branches = new List <BranchesDto>() { new BranchesDto() { BranchKeyId = id, BranchId = (rand.Next() % 5000).ToString(), Branch = "EAE", ProvinceSource = province, City = "Barcelona", Address = "Calle Rocafort 137", Address2 = "Calle Arago 65", Email = "*****@*****.**", Notes = "MyNotes", Fax = "+33889381982" }, new BranchesDto() { BranchKeyId = id, BranchId = (rand.Next() % 5000).ToString(), Branch = "Scala", ProvinceSource = province, City = "Barcelona", Address = "Calle Rocafort 189", Address2 = "Calle Arago 123", Email = "*****@*****.**", Notes = "MyNotes", Fax = "+33889381982" }, new BranchesDto() { BranchKeyId = id, BranchId = (rand.Next() % 5000).ToString(), Branch = "Scala", ProvinceSource = province, City = "Barcelona", Address = "Calle Rocafort 189", Address2 = "Calle Arago 123", Email = "*****@*****.**", Notes = "MyNotes", Fax = "+33889381982" } }; var dataObject = await _supplierDataServices.GetAsyncSupplierDo(id); Assert.NotNull(dataObject); dataObject.BranchesDto = dataObject.BranchesDto.Union(branches); //act bool retValue = await _supplierDataServices.Save(dataObject); // assert. Assert.IsTrue(retValue); var savedObject = await _supplierDataServices.GetAsyncSupplierDo(id); var currentObject = savedObject.BranchesDto.Intersect(branches); Assert.AreEqual(currentObject.Count(), branches.Count()); } }