public List <IPlatformModel> SelectAll() { List <IPlatformModel> models = new List <IPlatformModel>(); using (SQLiteConnection cnn = SqlConnectionInstance.GetSQLiteConnection()) { SQLiteCommand comm; cnn.Open(); string query = "SELECT * FROM Platforms"; comm = new SQLiteCommand(query, cnn); SQLiteDataReader reader; reader = comm.ExecuteReader(); while (reader.Read()) { IPlatformModel model = new PlatformModel { platformId = reader.GetInt32(1), name = reader.GetString(2) }; models.Add(model); } return(models); } }
public void Put_WithMockedModel_ShouldBeCalledOnce() { // Arrange var actualId = 4399; var dummyString = Guid.NewGuid().ToString().Replace("-", ""); var mockRepository = new Mock <IPlatformRepository>(); var dbModel = new PlatformModel() { Description = dummyString, }; mockRepository .Setup(m => m.Update(dbModel)); var controller = new PlatformController(mockRepository.Object); // Act controller.Put(actualId, dbModel); // Assert mockRepository .Verify(m => m.Update( It.Is <PlatformModel>( i => i.Id == actualId && i.Description == dummyString)), Times.Once()); }
private void CreatePlatform() { platform = new PlatformModel(_config.Platform); platform.OnAppear += OnPlatformAppear; platform.OnUp += OnPlatformUp; platform.OnDown += OnPlatformDown; }
public void InsertThenUpdate_ShouldReflectChanges() { // Arrange var expectedValue = "*****@*****.**"; var dummyString = Guid.NewGuid().ToString().Replace("-", ""); var dbModel = new PlatformModel() { Description = dummyString, }; // Act var newId = new PlatformRepository(AppState.ConnectionString) .Insert(dbModel); var dbModel2 = new PlatformRepository(AppState.ConnectionString) .Select(newId); dbModel2.Description = expectedValue; new PlatformRepository(AppState.ConnectionString) .Update(dbModel2); var actualValue = new PlatformRepository(AppState.ConnectionString) .Select(newId) .Description; // Assert Assert.AreEqual(expectedValue, actualValue); }
public void GetPlatform() { int targetId = 3; PlatformModel p = new PlatformModel(targetId); Console.WriteLine("Got platform id: {0}: {1}", p.Id, p.PlatformName); Console.WriteLine(p); }
public StageBuildController(StageData data) { _moon = new MoonSurface(data); IPlatformModel model = new PlatformModel(data, _moon.HeightOfThePlatformLocation); _platformInitialize = new PlatformInitialize(new PlatformFactory(data.PlatformParticles, model.Size), model); _audioMainThemePlayer = new AudioMainThemePlayer(data.MainMelody); }
public void ApplyChanges() { if (Model == null) { Model = new PlatformModel(); } Model.PlatformName = viewModel.Platform; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.layer == 8) { PlatformModel platformModel = collision.GetComponentInParent <PlatformModel>(); platformModel.SetYVelocity(0.0f); StartCoroutine(SetVelocity(platformModel)); } }
/// <summary> /// Based on chosen title and platform, searches API. /// </summary> /// <param name="sender"></param> private async void SearchGames(object sender) { var dataReciever = container.Resolve <IDataReciever <GameDetailsModel, string, int> >("GameModelsReciever"); PlatformModel selectedPlatform = sender as PlatformModel; PlatformModel platform = selectedPlatform; ObservableCollection <IGameDetailsModel> gameList = new ObservableCollection <IGameDetailsModel>(await dataReciever.GetByValue(SearchString, platform.platformId).ConfigureAwait(false)); Games = gameList; }
public PlatformPropertiesWindow(Platform platform, Canvas canvas, DesignerItem item, Level level) { InitializeComponent(); item.PropertyWindow = this; DataContext = new PlatformModel(this, platform, canvas, item, level); for(int i = 1; i <= platform.Path.Count; i++) (DataContext as PlatformModel).AddPoint(this, i); }
public int Insert(PlatformModel obj) { var storedProc = "sp_insert_platform"; var insertObj = new { description = obj.Description }; return(Insert(storedProc, insertObj)); }
public void UpdatePlatform_Save() { PlatformModel p = service.GetPlatform(1002); p.PlatformName = "Xbox 1080"; service.UpdatePlatform(p); var result = unitOfWork.Save(); Assert.AreEqual(true, result); }
public void Update(PlatformModel obj) { var storedProc = "sp_update_platform"; var updateObj = new { id = obj.Id, description = obj.Description }; Update(storedProc, updateObj); }
public void Update_Platform() { var db = new DatabaseRepository("VictoriousEntities"); PlatformModel p = db.GetPlatform(3); p.PlatformName = "Update Platform"; var result = db.UpdatePlatform(p); Assert.AreEqual(DbError.SUCCESS, result); }
public void AddPlatform_Save() { PlatformModel p = new PlatformModel() { PlatformName = "Xbox 720" }; service.AddPlatform(p); var result = unitOfWork.Save(); Assert.AreEqual(true, result); }
private void OnPlatformChangedEvent(object sender, EventArgs e) { platformLabel.Text = PlatformModel.GetPlatformName(activityModel.platform); if (activityModel.titleName == null && activityModel.npTitleId == null) { OnGameCloseEvent(this, null); } else { OnGameChangedEvent(this, null); } }
public void Add_Platform() { var db = new DatabaseRepository("VictoriousEntities"); PlatformModel p = new PlatformModel() { PlatformName = "Xbox" }; var result = db.AddPlatform(p); Assert.AreEqual(DbError.SUCCESS, result); }
public PlatformEntity(PlatformModel PlatformModel) { var Properties = PlatformModel.GetType().GetProperties(); foreach (var propertyInfo in Properties) { var prop = this.GetType().GetProperty(propertyInfo.Name); if (prop != null) { prop.SetValue(this, propertyInfo.GetValue(PlatformModel)); } } }
private IEnumerator SetVelocity(PlatformModel platformModel) { yield return(new WaitForSecondsRealtime(2.0f)); if (platformModel.transform.position.y > 0.0f) { platformModel.SetYVelocity(-platformModel.verticalVelocity); } else { platformModel.SetYVelocity(platformModel.verticalVelocity); } }
private void initGameTypes() { String titleName = OnPS.activityModel.titleName; String platform = PsnPlatformComboBox.SelectedItem.ToString(); if (titleName == null || OnPS.activityModel.platform != platform) { titleName = SampleGameName; } var dict = new Dictionary <int, string>(); dict.Add(int.Parse(GameViewModel.DEFAULT), titleName + " - " + PlatformModel.GetPlatformName(platform)); dict.Add(int.Parse(GameViewModel.PLATFORM_SHORTCUT), titleName + " - " + platform); dict.Add(int.Parse(GameViewModel.GAME_NAME_ONLY), titleName); GameType.DataSource = new BindingSource(dict, null); GameType.DisplayMember = "Value"; GameType.ValueMember = "Key"; }
public void InsertAndSelect_ShouldEqualInserted() { // Arrange var dbModel = new PlatformModel() { Description = "ex", }; var expectedValue = new PlatformRepository(AppState.ConnectionString) .Insert(dbModel); // Act var actualValue = new PlatformRepository(AppState.ConnectionString) .Select(expectedValue) .Id; // Assert Assert.AreEqual(expectedValue, actualValue); }
public void InsertAndDelete_ShouldNoLongerExistAfterDelete() { // Arrange var expectedValue = 0; var dbModel = new PlatformModel() { Description = "ex", }; // Act var newId = new PlatformRepository(AppState.ConnectionString).Insert(dbModel); new PlatformRepository(AppState.ConnectionString).Delete(newId); var actualValue = new PlatformRepository(AppState.ConnectionString) .Select(newId) .Id; // Assert Assert.AreEqual(expectedValue, actualValue); }
public void Post_WithMockedModel_ShouldReturnNewId() { // Arrange var mockRepository = new Mock <IPlatformRepository>(); var dbModel = new PlatformModel(); var expectedValue = 4399; mockRepository .Setup(m => m.Insert(dbModel)) .Returns(expectedValue); var controller = new PlatformController(mockRepository.Object); // Act var result = controller.Post(dbModel) as JsonResult; var actualValue = (int)result.Value; // Assert Assert.AreEqual(expectedValue, actualValue); }
private void InitializeGui() { this.gameStatusLabel.Text = ""; this.onlineStatusLabel.Text = ""; this.platformLabel.Text = ""; this.titleNameLabel.Text = ""; pictureBox1.LoadAsync(activityModel.avatarUrl); platformLabel.Text = PlatformModel.GetPlatformName(activityModel.platform); onlineStatusLabel.Text = activityModel.onlineStatus; if (activityModel.gameStatus != null) { OnGameStatusChangedEvent(this, new EventArgs()); } if (activityModel.onlineStatus == OnlineStatusModel.ONLINE) { if (activityModel.npTitleId != null && activityModel.titleName != null) { OnGameChangedEvent(this, new EventArgs()); } } }
public async Task ScheduleBack(ScrapySource source, PlatformModel platformModel, List <string> urls, ScheduleMessage scheduleMessage) { HttpSource httpSource = JsonConvert.DeserializeObject <HttpSource>(source.Source.Parameters.ToString()); if (httpSource.Layer > 0) { var transforms = scheduleMessage.Transforms .Where(x => x.MapToSource.Contains(source.Name)) .Select(x => { x.MapToSource = new string[] { source.Name }; return(x); }) .ToArray(); var scheduleSource = scheduleMessage.Sources.Where(x => x.Name == source.Name).First(); var loadMaps = scheduleMessage.LandingTargets.LoadMaps .Where(x => transforms.Any(y => y.Name == x.FromTransform)) .ToArray(); WebSeed webSeed = JsonConvert.DeserializeObject <WebSeed>(scheduleSource.Parameters.ToString()); foreach (var url in urls) { webSeed.SeedUrl = url; webSeed.Depth = httpSource.Layer - 1; scheduleSource.Parameters = webSeed; ScheduleMessage subSchedule = new ScheduleMessage() { MessageId = scheduleMessage.MessageId, Sources = new ScheduleSource[] { scheduleSource }, Transforms = transforms, LandingTargets = new ScheduleLoad() { LoadProviders = scheduleMessage.LandingTargets.LoadProviders, LoadMaps = loadMaps }, MessageName = scheduleMessage.MessageName, Scheduler = scheduleMessage.Scheduler }; await Task.Delay(sendRate); await ScheduleNew(subSchedule, platformModel); } } }
public void Get_WithParameter42_ShouldReturnDbModel() { // Arrange var actualId = 4399; var mockRepository = new Mock <IPlatformRepository>(); var expectedValue = new PlatformModel() { Id = actualId, Description = "et" }; mockRepository .Setup(m => m.Select(actualId)) .Returns(expectedValue); var controller = new PlatformController(mockRepository.Object); // Act var result = controller.Get(actualId) as JsonResult; var actualValue = (PlatformModel)result.Value; // Assert Assert.AreEqual(expectedValue, actualValue); }
public static GameCollectionGame MakeCapcomGameCollection() { List <GameModel> testGameList = new List <GameModel>(); GameCompanyModel microsoft = new GameCompanyModel { GameCompanyName = "Microsoft" }; GameCompanyModel capcom = new GameCompanyModel { GameCompanyName = "Capcom" }; PlatformModel x360 = new PlatformModel { Developer = microsoft, Publisher = microsoft, PlatformName = "Xbox 360" }; GameModel g1 = new PhysicalGameModel { Id = 1, Title = "Resident Evil 6", Box = false, Manual = false, Platform = x360, Publishers = new List <GameCompanyModel> { capcom }, Developers = new List <GameCompanyModel> { capcom } }; GameModel g2 = new PhysicalGameModel { Id = 2, Title = "Dead Rising 2", Box = false, Manual = false, Platform = x360, Publishers = new List <GameCompanyModel> { capcom }, Developers = new List <GameCompanyModel> { capcom } }; GameModel g3 = new DigitalGameModel { Id = 3, Title = "Mega Man 10", Platform = x360, Publishers = new List <GameCompanyModel> { capcom }, Developers = new List <GameCompanyModel> { capcom }, ServiceName = "Xbox Live", ServiceId = 2 }; testGameList.Add(g1); testGameList.Add(g2); testGameList.Add(g3); GameCollectionGame gc = new GameCollectionGame { GamesInCollection = testGameList, Title = "Capcom Classics Collection", Publishers = new List <GameCompanyModel> { capcom }, Platform = x360 }; return(gc); }
public async Task ScheduleNew(ScheduleMessage scheduleMessage, PlatformModel platformModel) { Dictionary <string, ScrapySource> sourceDict = SourceGenManager.Instance.GenerateSource(scheduleMessage.Sources, scheduleMessage.MessageId); TransformEventData transformEventData = TransformGenManager.Instance.GenerateTransform(sourceDict, scheduleMessage.Transforms); LoadEventData loadEventData = LoadGenManager.Instance .GenerateLoadEvent(transformEventData, scheduleMessage.LandingTargets); MessageIndexer messageIndexer = new MessageIndexer() { MessageId = scheduleMessage.MessageId, MessageName = scheduleMessage.MessageName, StartTime = DateTime.Now, SourceJobIds = sourceDict.Values .Select(x => x.JobId).ToDictionary(x => x, x => 0), TransformJobIds = transformEventData.TransformEvents .SelectMany(x => x.Value) .Select(x => x.JobId) .ToDictionary(x => x, x => 0), LoadJobIds = loadEventData.LoadEvents .Select(x => x.JobId) .ToDictionary(x => x, x => 0) }; TaskingManager manager = new TaskingManager(); manager.AddTask(platformModel.CoreCache.StoreAsync(PrefixConst.MESSAGE_JOBs + messageIndexer.MessageId, messageIndexer)); foreach (var srcKey in transformEventData.SourceMapToTransform.Keys) { manager.AddTask(platformModel.CoreCache.StoreAsync( PrefixConst.SOURCE_TRANSFOR_MAP + srcKey, transformEventData.SourceMapToTransform[srcKey])); } foreach (var transkv in loadEventData.TransformToLoadMap) { manager.AddTask(platformModel.CoreCache.StoreStringAsync( PrefixConst.TRANSFORM_LOAD_MAP + transkv.Key, transkv.Value)); } foreach (var source in sourceDict.Values) { manager.AddTask(platformModel.CoreCache.StoreAsync( PrefixConst.SOURCE_META + source.JobId, source)); } foreach (var transform in transformEventData.TransformEvents.SelectMany(x => x.Value)) { manager.AddTask(platformModel.CoreCache.StoreAsync( PrefixConst.TRANSFORM_META + transform.JobId, transform)); } foreach (var load in loadEventData.LoadEvents) { manager.AddTask(platformModel.CoreCache.StoreAsync( PrefixConst.LOAD_META + load.JobId, load)); } await manager.WhenAll(); await PublishSourceJobs( scheduleMessage.MessageName, scheduleMessage.MessageId, platformModel.PlatformExit, messageIndexer.SourceJobIds.Keys.ToArray()); }
private void Start() { _platformModel = new PlatformModel(); _platformView = new PlatformView(); }
public void UpdatePlatform(PlatformModel platformToUpdate) { unitOfWork.PlatformRepo.Update(platformToUpdate); }
public void AddPlatform(PlatformModel platformToAdd) { unitOfWork.PlatformRepo.Add(platformToAdd); }