public async Task Should_Raise_Notification_On_Delete()
        {
            // Act
            await _appService.Delete(Guid.Empty);

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var message = string.Format(LocalLocalizationSource.GetString(ApplicationService.Error.ApplicationServiceOnInvalidIdError, _culture), "id");

            Assert.Contains(LocalNotification.GetAll(), n => n.Message == message);
        }
        public async Task Should_Raise_Notification_On_Create()
        {
            // Act
            var customer = await _appService.Create(null);

            // Assert
            Assert.NotNull(customer);
            Assert.True(LocalNotification.HasNotification());
            var message = string.Format(LocalLocalizationSource.GetString(ApplicationService.Error.ApplicationServiceOnInvalidDtoError, _culture), "dto");

            Assert.Contains(LocalNotification.GetAll(), n => n.Message == message);
        }
예제 #3
0
        public async Task Should_Raise_Notification_On_Update()
        {
            // Act
            var product = await _appService.UpdateProductAsync(Guid.Empty, null);

            // Assert
            Assert.NotNull(product);
            Assert.True(LocalNotification.HasNotification());
            Assert.Equal(2, LocalNotification.GetAll().Count());
            var message = string.Format(LocalLocalizationSource.GetString(ApplicationService.Error.ApplicationServiceOnInvalidDtoError, _culture), "dto");

            Assert.Contains(LocalNotification.GetAll(), n => n.Message == message);
            message = string.Format(LocalLocalizationSource.GetString(ApplicationService.Error.ApplicationServiceOnInvalidIdError, _culture), "id");
            Assert.Contains(LocalNotification.GetAll(), n => n.Message == message);
        }
        public async Task Should_Raise_Notification_On_Get_Null()
        {
            // Act
            var customer = await _appService.Get(null);

            // Assert
            Assert.NotNull(customer);
            Assert.True(LocalNotification.HasNotification());
            var message = string.Format(LocalLocalizationSource.GetString(ApplicationService.Error.ApplicationServiceOnInvalidIdError, _culture), "request");

            Assert.Contains(LocalNotification.GetAll(), n => n.Message == message);

            // Act
            customer = await _appService.Get(new RequestDto <Guid>());

            // Assert
            Assert.NotNull(customer);
            Assert.True(LocalNotification.HasNotification());
            message = string.Format(LocalLocalizationSource.GetString(ApplicationService.Error.ApplicationServiceOnInvalidIdError, _culture), "request");
            Assert.Contains(LocalNotification.GetAll(), n => n.Message == message);
        }
예제 #5
0
        public async Task Should_Raise_Notification_On_Get_Null()
        {
            // Act
            var product = await _appService.GetProductAsync(null);

            // Assert
            Assert.Null(product);
            Assert.True(LocalNotification.HasNotification());
            var message = string.Format(LocalLocalizationSource.GetString(ApplicationService.Error.ApplicationServiceOnInvalidIdError, _culture), "request");

            Assert.Contains(LocalNotification.GetAll(), n => n.Message == message);

            // Act
            product = await _appService.GetProductAsync(new DefaultRequestDto());

            // Assert
            Assert.Null(product);
            Assert.True(LocalNotification.HasNotification());
            message = string.Format(LocalLocalizationSource.GetString(ApplicationService.Error.ApplicationServiceOnInvalidIdError, _culture), "request");
            Assert.Contains(LocalNotification.GetAll(), n => n.Message == message);
        }