public CollectionEndPointSetCollectionCommand( ICollectionEndPoint modifiedEndPoint, DomainObjectCollection newCollection, IDomainObjectCollectionData modifiedCollectionData, ICollectionEndPointCollectionManager collectionEndPointCollectionManager, IClientTransactionEventSink transactionEventSink) : base( ArgumentUtility.CheckNotNull("modifiedEndPoint", modifiedEndPoint), null, null, ArgumentUtility.CheckNotNull("transactionEventSink", transactionEventSink)) { ArgumentUtility.CheckNotNull("newCollection", newCollection); ArgumentUtility.CheckNotNull("modifiedCollectionData", modifiedCollectionData); ArgumentUtility.CheckNotNull("collectionEndPointCollectionManager", collectionEndPointCollectionManager); if (modifiedEndPoint.IsNull) { throw new ArgumentException("Modified end point is null, a NullEndPointModificationCommand is needed.", "modifiedEndPoint"); } _newCollection = newCollection; _modifiedCollectionData = modifiedCollectionData; _collectionEndPointCollectionManager = collectionEndPointCollectionManager; var oldOppositeObjects = ModifiedCollectionData; _removedObjects = oldOppositeObjects.Where(oldObject => !NewCollection.Contains(oldObject.ID)).ToArray(); var newOppositeObjects = NewCollection.Cast <DomainObject> (); _addedObjects = newOppositeObjects.Where(newObject => !ModifiedCollectionData.ContainsObjectID(newObject.ID)).ToArray(); }
// Use this for initialization void Start() { number = 0; correct = 0; allPuzzle = new NewCollection(); allPuzzle.init(); rollPuzzle(); }
private void UpdateButtonState() { NewCollection.RaiseCanExecuteChanged(); OpenCollection.RaiseCanExecuteChanged(); SaveCollection.RaiseCanExecuteChanged(); EditCollection.RaiseCanExecuteChanged(); DeleteCollection.RaiseCanExecuteChanged(); CommitCollection.RaiseCanExecuteChanged(); ReviewCollection.RaiseCanExecuteChanged(); }
public void deveRetornarMenosUmParaValorInexistente() { NewCollection collection = new NewCollection(); collection.Add("ano", "1979"); collection.Add("mes", "Agosto"); collection.Add("mes", "Fevereiro"); long retorno = collection.IndexOf("ano", "2017"); Assert.AreEqual(-1, retorno); }
private bool IsNeedSave() { var isNeedSave = false; if (!NewCollection.IsNullOrEmpty() || !ModifiedCollection.IsNullOrEmpty() || !DeletedCollection.IsNullOrEmpty()) { isNeedSave = true; } return(isNeedSave); }
private void UpdateButtonState() { NewCollection.RaiseCanExecuteChanged(); OpenCollection.RaiseCanExecuteChanged(); SaveCollection.RaiseCanExecuteChanged(); EditCollection.RaiseCanExecuteChanged(); DeleteCollection.RaiseCanExecuteChanged(); CommitCollection.RaiseCanExecuteChanged(); ReviewCollection.RaiseCanExecuteChanged(); ViewRecordCommand.RaiseCanExecuteChanged(); //IsSaveVisible = FormArgs == null ? false : FormArgs.HasNoRecords == false && FormArgs.ViewMode != FormMode.DELETEMODE; OnPropertyChanged("IsCommitVisible"); }
public void CountChangedTest() { NewCollection <Place> places = new NewCollection <Place>("Тестовая коллекция"); Journal j = new Journal("Тестовый журнал"); places.CollectionCountChanged += new CollectionHandler(j.CollectionCountChanged); //Act places.Add(new Place()); places.Remove(new Place()); //Assert Assert.AreEqual(2, j.Count); }
public override void Commit() { if (!Committed) { var newList = NewCollection.Select(pre => pre.Value).ToList(); var modifiedList = ModifiedCollection.Select(pre => pre.Value).ToList(); var deleteList = DeletedCollection.Select(pre => pre.Value).ToList(); localPersistenceDAL.Value.PersistenceToDatabase(newList, modifiedList, deleteList); //执行事务操作。 Committed = true; } }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } NewCollection = await _context.NewCollection.FirstOrDefaultAsync(m => m.Id == id); if (NewCollection == null) { return(NotFound()); } return(Page()); }
public void deveRetornarIndiceCorreto() { NewCollection collection = new NewCollection(); collection.Add("ano", "1979"); collection.Add("mes", "Agosto"); collection.Add("ano", "2007"); collection.Add("mes", "Fevereiro"); collection.Add("ano", "1994"); collection.Add("mes", "Março"); collection.Add("ano", "2004"); collection.Add("ano", "1978"); long retorno = collection.IndexOf("ano", "2007"); Assert.AreEqual(4, retorno); }
public void deveRemoverChavePassada() { NewCollection collection = new NewCollection(); collection.Add("ano", "1979"); collection.Add("mes", "Agosto"); collection.Add("dia", "02"); collection.Remove("ano"); IList <string> retorno = new List <string>(); retorno = collection.Get("ano", 0, 2); IList <string> result = new List <string>(); Assert.AreEqual(result.ToString(), retorno.ToString()); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } NewCollection = await _context.NewCollection.FindAsync(id); if (NewCollection != null) { _context.NewCollection.Remove(NewCollection); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public void deveRetornarListaDoPrimeiroAoPenultimo() { NewCollection collection = new NewCollection(); collection.Add("ano", "1979"); collection.Add("ano", "1994"); collection.Add("ano", "2007"); IList <string> retorno = new List <string>(); retorno = collection.Get("ano", -1, -2); IList <string> result = new List <string>(); result.Add("1979"); result.Add("1994"); Assert.AreEqual(result.ToString(), retorno.ToString()); }
public void ReferenceChangedTest() { NewCollection <Place> places = new NewCollection <Place>("Тестовая коллекция"); Journal j = new Journal("Тестовый журнал"); places.CollectionReferenceChanged += new CollectionHandler(j.CollectionReferenceChanged); places.Add(new Place()); places.Add(new Region()); places.Add(new Place()); places.Add(new Region()); places.Add(new Place()); places.Add(new Address()); places[1] = new Address(); //Assert Assert.AreEqual(1, j.Count); }
public void deveRetornarListaComTodosItensDaChave() { NewCollection collection = new NewCollection(); collection.Add("ano", "1979"); collection.Add("ano", "1994"); collection.Add("ano", "2007"); IList <string> retorno = new List <string>(); retorno = collection.Get("ano", 0, 4); IList <string> result = new List <string>(); result.Add("1979"); result.Add("1994"); result.Add("2007"); Assert.AreEqual(result.ToString(), retorno.ToString()); }
static void chapter1() { NewCollection names = new NewCollection(); names.Add("David"); names.Add("Bernica"); names.Add("Raymond"); names.Add("Clayton"); foreach (Object name in names) { Console.WriteLine(name); } String numOfNames = "Number of names: {0}"; Console.WriteLine(numOfNames, names.Count()); names.Remove("Raymond"); Console.WriteLine(numOfNames, names.Count()); names.Clear(); Console.WriteLine(numOfNames, names.Count()); }
public void Test() { CollectionAssert.AreEquivalent(NewCollection.Concat(AnotherCollection), Uniter); }