public async Task Delete_CallsRemoveWatcherAsync_IfIdIsValid()
        {
            var teamId    = Guid.NewGuid();
            var ticketId  = Guid.NewGuid();
            var watcherId = Guid.NewGuid();

            _notificationServiceMock
            .Setup(service => service.RemoveWatcherAsync(teamId, ticketId, watcherId))
            .Returns(Task.CompletedTask);

            await _sut.Delete(teamId, ticketId, watcherId);

            _notificationServiceMock.Verify(service => service.RemoveWatcherAsync(teamId, ticketId, watcherId));
        }
        private void DeleteNotification_Click(object sender, RoutedEventArgs e)
        {
            if (NotificationListView.SelectedItem == null)
            {
                return;
            }

            var result = MessageBox.Show("Da li ste sigurni da želite da obrišete ovo obavestenje?", "Potvrda brisanja", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.No)
            {
                return;
            }

            Notification notification = (Notification)NotificationListView.SelectedItem;

            _notificationController.Delete(notification);
            UpdateTable();
        }
Пример #3
0
        public async Task NotificationRule_Delete_Test_Not_Null_ID()
        {
            //Arrange
            var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[]
            {
                new Claim(ClaimTypes.Name, "example name"),
                new Claim(ClaimTypes.NameIdentifier, "1"),
                new Claim("custom-claim", "example claim value"),
            }, "mock"));

            var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>();

            optionsBuilder.UseInMemoryDatabase(databaseName: "CommerceTestDB");
            var _dbContext = new ApplicationDbContext(optionsBuilder.Options);

            var controller = new NotificationController(_dbContext);

            controller.ControllerContext = new ControllerContext()
            {
                HttpContext = new DefaultHttpContext()
                {
                    User = user
                }
            };

            var notificationRule = new Notification_Rule();

            notificationRule.Type      = "Deposit";
            notificationRule.Condition = "NA";
            notificationRule.Value     = -1;

            //Act
            var result = await controller.Delete(1);

            //Assert
            Assert.NotNull(result);
        }
Пример #4
0
 private async Task ThenDeleteTestWatcher()
 {
     await _sut.Delete(_teamId, _ticketId, _user.Id);
 }