public void GetEntityWithNotExistingID() { ExtraContentRepository repository = new ExtraContentRepository(); ExtraContent resultExtra = repository.GetEntity <ExtraContent>(NotExistindID); Assert.IsNull(resultExtra); }
public void GetEntityEqualsToOriginal() { ExtraContentRepository repository = new ExtraContentRepository(); List <ExtraContent> extras = repository.ExtraContents; ExtraContent resultExtra = repository.GetEntity <ExtraContent>(ExistingID); Assert.AreEqual(repository.ExtraContents.Where(u => u.ID == ExistingID).FirstOrDefault(), resultExtra); }
public void UpdateExtraContent(ExtraContent extraContent) { if (extraContent == null) { throw new ArgumentNullException("extraContent"); } _extraContentRepository.Update(extraContent); }
private void AddExtraContent() { if (_toolBarWrapPanel != null && !ExtraContent.IsNullOrEmpty()) { foreach (var child in ExtraContent) { _toolBarWrapPanel.Children.Add(child); } } }
public void SaveContainsEntity() { ExtraContentRepository repository = new ExtraContentRepository(); ExtraContent extra = repository.ExtraContents[0]; ExtraContent newExtra = new ExtraContent(); newExtra.ID = extra.ID; newExtra.Reinitialization(extra); Assert.IsFalse(repository.SaveEntity(newExtra)); }
public virtual void DeleteExtraContent(ExtraContent extraContent) { if (extraContent == null) { throw new ArgumentNullException("extraContent"); } _extraContentRepository.Delete(extraContent); //event notification _eventPublisher.EntityDeleted(extraContent); }
public int InsertExtraContent(ExtraContent extraContent) { if (extraContent == null) { throw new ArgumentNullException("extraContent"); } _extraContentRepository.Insert(extraContent); //event notification _eventPublisher.EntityInserted(extraContent); return(extraContent.Id); }
public bool Equals(SaveFileIV other) { if (other == null) { return(false); } return(Name.Equals(other.Name) && TimeStamp.Equals(other.TimeStamp) && SaveVersion.Equals(other.SaveVersion) && SaveSizeInBytes.Equals(other.SaveSizeInBytes) && ScriptSpaceSize.Equals(other.ScriptSpaceSize) && SimpleVars.Equals(other.SimpleVars) && PlayerInfo.Equals(other.PlayerInfo) && ExtraContent.Equals(other.ExtraContent) && Scripts.Equals(other.Scripts) && Garages.Equals(other.Garages) && GameLogic.Equals(other.GameLogic) && Paths.Equals(other.Paths) && Pickups.Equals(other.Pickups) && RestartPoints.Equals(other.RestartPoints) && RadarBlips.Equals(other.RadarBlips) && Zones.Equals(other.Zones) && GangData.Equals(other.GangData) && CarGenerators.Equals(other.CarGenerators) && Stats.Equals(other.Stats) && IplStore.Equals(other.IplStore) && StuntJumps.Equals(other.StuntJumps) && Radio.Equals(other.Radio) && Objects.Equals(other.Objects) && Relationships.Equals(other.Relationships) && Inventory.Equals(other.Inventory) && UnusedPools.Equals(other.UnusedPools) && UnusedPhoneInfo.Equals(other.UnusedPhoneInfo) && UnusedAudioScript.Equals(other.UnusedAudioScript) && UnusedSetPieces.Equals(other.UnusedSetPieces) && UnusedStreaming.Equals(other.UnusedStreaming) && UnusedPedTypeInfo.Equals(other.UnusedPedTypeInfo) && UnusedTags.Equals(other.UnusedTags) && UnusedShopping.Equals(other.UnusedShopping) && UnusedGangWars.Equals(other.UnusedGangWars) && UnusedEntryExits.Equals(other.UnusedEntryExits) && Unused3dMarkers.Equals(other.Unused3dMarkers) && UnusedVehicles.Equals(other.UnusedVehicles) && UnusedExtraBlock.Equals(other.UnusedExtraBlock) && GfwlData.Equals(other.GfwlData)); }
public void RemoveUserWithExistingID() { ExtraContentRepository repository = new ExtraContentRepository(); List <ExtraContent> startList = new List <ExtraContent>(repository.ExtraContents); if (!repository.Remove(ExistingID)) { Assert.Fail("Error deleting entry."); } ExtraContent deletedExtra = startList.Where(u => u.ID == ExistingID).FirstOrDefault(); if (deletedExtra == null) { Assert.Fail("Error. Deleted entry not found."); } if (startList.Count != repository.ExtraContents.Count + 1) { Assert.Fail("After deleting the entry, the collection size did not decrease by 1."); } bool successFlag = false; foreach (var startItem in startList) { successFlag = false; if (startItem == deletedExtra) { continue; // Удаленную запись после удаления уже не сравнивать. } foreach (var resultItem in repository.ExtraContents) { if (startItem.Equals(resultItem)) { successFlag = true; // Успех. Соответствующая запись найдена break; } } // Если для одной из записей исходной коллекции не найдена соответствующая запись в результирующей коллекции // за ислючением удаленной записи. if (!successFlag) { Assert.Fail(EntriesNotMutchErrorText); } } }
public override bool SaveEntity <T>(T entity) { ExtraContent newExtra = entity as ExtraContent; if (newExtra == null) { return(false); } if (ExtraContents.Contains(newExtra)) { return(false); } // если запись с таким ID уже есть в базе, то изменить ее поля ExtraContent extra = ExtraContents.Where(u => u.ID == newExtra.ID).FirstOrDefault(); if (extra != null) { extra.Reinitialization(newExtra); return(true); } ExtraContents.Add(newExtra); return(true); }
public static ExtraContent ToEntity(this ExtraContentModel model, ExtraContent destination) { return(Mapper.Map(model, destination)); }
public static ExtraContentModel ToModel(this ExtraContent entity) { return(Mapper.Map <ExtraContent, ExtraContentModel>(entity)); }