private void SetupWindowData() { SelectedItemNotification = itemNotificationController.GetItemNotificationByItemId(SelectedItem.Id); ItemName.Text = SelectedItem.Name; ItemDescription.Text = SelectedItem.Description; ItemDate.Text = String.Format("{0:yyyy-MM-dd HH:mm}", SelectedItem.Date); }
public void AddNotification(string content) { SoundManager.instance.SFX_Notification(); ItemNotification itemNotification = Instantiate(itemNotificationPrefab, gameObject.transform); itemNotification.ShowNotification(content); }
public void ShouldThrowDbUpdateExceptionWhenSameNotificationWillBeSavedTwoTimes() { // arrange Item item = new Item { Name = "name", Description = "descritpion", Date = DateTime.Now }; dbContext.Items.Add(item); dbContext.SaveChanges(); ItemNotification invalidNotification = new ItemNotification { Item = item, ItemId = item.Id, Notified = false, NotifiactionDate = DateTime.Now }; // act itemNotificationRepository.Save(invalidNotification); itemNotificationRepository.Save(invalidNotification); }
public CustomDisplayPart(ItemNotification itemNotification) { _itemNotification = itemNotification; DataContext = itemNotification; // this allows to bind ui with data in notification InitializeComponent(); WtTextBlock.Text = itemNotification.PostLoad.Type == OrderType.Buy ? "WTB" : "WTS"; Image.MouseUp += ClickImage; }
public void ShouldCallDeleteOnItemNotificationRepository() { // arrange ItemNotification itemNotification = new ItemNotification(); // act itemNotificationController.DeleteItemNotification(itemNotification); // assert mockItemNotificationRepository.Verify(x => x.Delete(itemNotification), Times.Once); }
public void ShouldReturnItemNotificationByItemId() { // arrange long itemId = 1; ItemNotification expectedItemNotification = new ItemNotification(); mockItemNotificationRepository.Setup(c => c.FindByItemId(itemId)).Returns(expectedItemNotification); // act ItemNotification returnedItemNotification = itemNotificationController.GetItemNotificationByItemId(itemId); // assert Assert.AreEqual(expectedItemNotification, returnedItemNotification); }
public void ShouldReturnItemNotificationByItemId() { // arrange Item item = PrepareItem("name", "descritpion", TODAY, false); ItemNotification notification = PrepareItemNotification(item, TODAY, false); dbContext.Items.Add(item); dbContext.ItemNotifications.Add(notification); dbContext.SaveChanges(); // act ItemNotification returnedItemNotification = itemNotificationRepository.FindByItemId(item.Id); // assert Assert.AreEqual(notification, returnedItemNotification); }
/// <summary> /// Move up existing notifications. /// if required. /// </summary> private void MoveNotsUp() { foreach (GameObject prefab in _notPool.pool) { if (prefab.activeSelf == true) { ItemNotification itemNot = prefab.gameObject.GetComponent <ItemNotification>(); if (itemNot.displayed) { // move up displayed notifications. itemNot.MoveUp(); } } } }
public void ShouldThrowEntityValidationExceptionWhenItemIsNull() { // arrange Item item = new Item(); dbContext.Items.Add(item); ItemNotification invalidNotification = new ItemNotification { ItemId = item.Id, Notified = false, NotifiactionDate = DateTime.Now }; // act itemNotificationRepository.Save(invalidNotification); }
public void ShoulDeleteItemNotification() { // arrange Item item = PrepareItem("name", "descritpion", TODAY, false); ItemNotification notification = PrepareItemNotification(item, TODAY, false); dbContext.Items.Add(item); dbContext.ItemNotifications.Add(notification); dbContext.SaveChanges(); // act itemNotificationRepository.Delete(notification); // assert ItemNotification returnedItemNotification = itemNotificationRepository.FindByItemId(item.Id); Assert.IsNull(returnedItemNotification); }
public void ShoulUpdateItemNotification() { // arrange Item item = PrepareItem("name", "descritpion", TODAY, false); ItemNotification notification = PrepareItemNotification(item, TODAY, false); dbContext.Items.Add(item); dbContext.ItemNotifications.Add(notification); dbContext.SaveChanges(); // act notification.Notified = true; itemNotificationRepository.Update(notification); // assert ItemNotification returnedItemNotification = itemNotificationRepository.FindByItemId(item.Id); Assert.AreEqual(true, returnedItemNotification.Notified); }
void NotificationSettingsWindowActivated(object sender, EventArgs e) { SelectedItemNotification = null; try { SetupWindowData(); if (SelectedItemNotification != null) { SetUpNotificationControls(SelectedItemNotification.NotifiactionDate, true); } else { SetUpNotificationControls(null, false); } } catch (Exception ex) { excpetionHandler.HandleException(ex); } }
public void ShouldDeleteItemAndItsNotification() { // arrange Item item = PrepareItem("name", "descritpion", TODAY, false); ItemNotification notification = PrepareItemNotification(item, TODAY, false); dbContext.Items.Add(item); dbContext.ItemNotifications.Add(notification); dbContext.SaveChanges(); // act itemRepository.Delete(item); // assert List <Item> items = itemRepository.FindByDate(TODAY); ItemNotification returnedNotification = itemNotificationRepository.FindByItemId(item.Id); Assert.AreEqual(0, items.Count); Assert.IsNull(returnedNotification); }
public void ShoulReturnNotNotifiedItemsNotificaitonsByDateTime() { // arrange Item firstItem = PrepareItem("name1", "descritpion1", TODAY, false); ItemNotification firstNotification = PrepareItemNotification(firstItem, TODAY, false); Item secondItem = PrepareItem("name2", "descritpion2", TODAY, false); ItemNotification secondNotification = PrepareItemNotification(secondItem, TODAY, true); dbContext.Items.Add(firstItem); dbContext.Items.Add(secondItem); dbContext.ItemNotifications.Add(firstNotification); dbContext.ItemNotifications.Add(secondNotification); dbContext.SaveChanges(); // act List <ItemNotification> returnedNotifications = itemNotificationRepository.FindNotNotifiedByNotificationDate(TODAY); // assert Assert.AreEqual(1, returnedNotifications.Count); CollectionAssert.Contains(returnedNotifications, firstNotification); }
public void DeleteItemNotification(ItemNotification itemNotification) { itemNotificationRepository.Delete(itemNotification); }
private void UpdateNotificationStatus(ItemNotification notification) { notification.Notified = true; itemNotificationRepository.Update(notification); }
public void SaveItemNotification(ItemNotification itemNotification) { itemNotificationRepository.Save(itemNotification); }
public void Save(ItemNotification notification) { dbContext.Entry(notification).State = EntityState.Added; dbContext.SaveChanges(); }
public void Update(ItemNotification notification) { dbContext.Entry(notification).State = EntityState.Modified; dbContext.SaveChanges(); }
public override void Clear() { itemInfoList.Clear(); notification = null; }
public void Delete(ItemNotification notification) { dbContext.ItemNotifications.Remove(notification); dbContext.SaveChanges(); }