Ejemplo n.º 1
0
        public void ShouldValidatePurchaseOrdeWhenNoReportAnyLine()
        {
            var purchaseOrderBuilder = PurchaseOrder.New(LocalNotification);

            purchaseOrderBuilder.Build();

            Assert.NotEmpty(LocalNotification.GetAll());
            Assert.Contains(LocalNotification.GetAll(), a => a.DetailedMessage == PurchaseOrder.Error.PurchaseOrderMustBeLines.ToString());
        }
Ejemplo n.º 2
0
        public void Professional_Service_Not_Return_Non_Existing_Professional()
        {
            // Act
            _profissionalService.GetProfessional(new RequestDto <ComposeKey <Guid, decimal> >(new ComposeKey <Guid, decimal>(Guid.NewGuid(), 99)));

            // Assert
            Assert.True(LocalNotification.HasNotification());
            Assert.True(LocalNotification.GetAll().Any(a => a.Message == Professional.Error.CouldNotFindProfessional.ToString()));
        }
Ejemplo n.º 3
0
        public void Should_Get_Professional_With_Error()
        {
            // Act
            var response = _professionalAppService.GetProfessional(new RequestDto <ComposeKey <Guid, decimal> >(new ComposeKey <Guid, decimal>(_professionalPoco.Code, 99)));

            // Assert
            Assert.Null(response);
            Assert.True(LocalNotification.HasNotification());
            Assert.True(LocalNotification.GetAll().Any(a => a.Message == Professional.Error.CouldNotFindProfessional.ToString()));
        }
Ejemplo n.º 4
0
        public void ShouldValidatePurchaseOrdeWhenReportInvalidDiscount()
        {
            var purchaseOrderBuilder = PurchaseOrder.New(LocalNotification)
                                       .WithDiscount(-1);

            purchaseOrderBuilder.Build();

            Assert.NotEmpty(LocalNotification.GetAll());
            Assert.Contains(LocalNotification.GetAll(), a => a.DetailedMessage == PurchaseOrder.Error.PurchaseOrderMustHaveValidDiscount.ToString());
        }
Ejemplo n.º 5
0
        public void ShouldValidatePurchaseOrdeWhenNoReportCustomer()
        {
            var purchaseOrderBuilder = PurchaseOrder.New(LocalNotification)
                                       .WithCustomer(Guid.Empty);

            purchaseOrderBuilder.Build();

            Assert.NotEmpty(LocalNotification.GetAll());
            Assert.Contains(LocalNotification.GetAll(), a => a.DetailedMessage == PurchaseOrder.Error.PurchaseOrderMustHaveCustomer.ToString());
        }
Ejemplo n.º 6
0
        public void Should_Insert_Null_Person_With_Error()
        {
            // Act
            _personAppService.Create(null);

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(n => n.Message == AppApplicationErrors.AppApplicationErrorsInvalidDto.ToString()));
        }
Ejemplo n.º 7
0
        public void Should_Insert_Person_With_Error()
        {
            // Act
            _personAppService.Create(new PersonDto());

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == Person.Error.PersonNameMustHaveValue.ToString()));
        }
Ejemplo n.º 8
0
        public void Should_Delete_Person_With_Error()
        {
            // Act
            _personAppService.Delete(99);

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == AppDomainErrors.TnfAppDomainErrorOnDeleteCouldNotFind.ToString()));
        }
Ejemplo n.º 9
0
        public void Should_Update_Invalid_Id_With_Error()
        {
            // Act
            _personAppService.Update(0, new PersonDto());

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(n => n.Message == AppApplicationErrors.AppApplicationErrorsInvalidId.ToString()));
        }
Ejemplo n.º 10
0
        public void Specialty_Service_Insert_Not_Accept_Invalid_Specialty()
        {
            // Act
            _specialtyService.CreateSpecialty(new SpecialtyBuilder(LocalNotification));

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == Specialty.Error.SpecialtyDescriptionMustHaveValue.ToString()));
        }
Ejemplo n.º 11
0
        public void Specialty_Service_Delete_Not_Accept_Non_Existing_Specialty()
        {
            // Act
            _specialtyService.DeleteSpecialty(99);

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == Specialty.Error.CouldNotFindSpecialty.ToString()));
        }
Ejemplo n.º 12
0
        public void Specialty_Service_Not_Return_Non_Existing_Specialty()
        {
            // Act
            _specialtyService.GetSpecialty(new RequestDto(99));

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == Specialty.Error.CouldNotFindSpecialty.ToString()));
        }
Ejemplo n.º 13
0
        public void Professional_Service_Delete_Not_Accept_Non_Existing_Professional()
        {
            // Act
            _profissionalService.DeleteProfessional(new ComposeKey <Guid, decimal>(Guid.NewGuid(), 99));

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == Professional.Error.CouldNotFindProfessional.ToString()));
        }
Ejemplo n.º 14
0
        public void Should_Delete_Professional_With_Error()
        {
            // Act
            _professionalAppService.DeleteProfessional(new ComposeKey <Guid, decimal>(_professionalPoco.Code, 99));

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == Professional.Error.CouldNotFindProfessional.ToString()));
        }
Ejemplo n.º 15
0
        public async Task WhiteHouse_Service_Not_Return_Non_Existing_President()
        {
            // Act
            await _whiteHouseService.GetPresidentById(new RequestDto <string>("99"));

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == President.Error.CouldNotFindPresident.ToString()));
        }
Ejemplo n.º 16
0
        public void Should_Insert_Specialty_With_Error()
        {
            // Act
            _specialtyAppService.CreateSpecialty(new SpecialtyDto());

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == Specialty.Error.SpecialtyDescriptionMustHaveValue.ToString()));
        }
Ejemplo n.º 17
0
        public void Should_Insert_Null_Professional_With_Error()
        {
            // Act
            _professionalAppService.CreateProfessional(null);

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(n => n.Message == Error.InvalidParameter.ToString()));
        }
Ejemplo n.º 18
0
        public void Should_Update_Null_Specialty_With_Error()
        {
            // Act
            _specialtyAppService.UpdateSpecialty(1, null);

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(n => n.Message == Error.InvalidParameter.ToString()));
        }
Ejemplo n.º 19
0
        public void Should_Delete_Specialty_With_Error()
        {
            // Act
            _specialtyAppService.DeleteSpecialty(99);

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == Specialty.Error.CouldNotFindSpecialty.ToString()));
        }
Ejemplo n.º 20
0
        public async Task Should_Delete_President_With_Error()
        {
            // Act
            await _whiteHouseAppService.DeletePresidentAsync("99");

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == President.Error.CouldNotFindPresident.ToString()));
        }
Ejemplo n.º 21
0
        public async Task Should_Insert_Null_President_With_Error()
        {
            // Act
            await _whiteHouseAppService.InsertPresidentAsync(null);

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(n => n.Message == Error.InvalidParameter.ToString()));
        }
Ejemplo n.º 22
0
        public async Task Should_Update_Invalid_Id_With_Error()
        {
            // Act
            await _whiteHouseAppService.UpdatePresidentAsync("", new PresidentDto());

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(n => n.Message == Error.InvalidParameter.ToString()));
        }
Ejemplo n.º 23
0
        public async Task Should_Get_President_With_Error()
        {
            // Act
            await _whiteHouseAppService.GetPresidentById(new RequestDto <string>("2"));

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == President.Error.CouldNotFindPresident.ToString()));
        }
        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);
        }
Ejemplo n.º 25
0
        public async Task WhiteHouse_Service_Delete_Not_Accept_Non_Existing_President()
        {
            // Act
            await _whiteHouseService.DeletePresidentAsync("99");

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.True(notifications.Any(a => a.Message == President.Error.CouldNotFindPresident.ToString()));
        }
        public async Task Should_Raise_Notification_On_Create_With_Specifications()
        {
            // Act
            var purchaseOrder = await _appService.CreatePurchaseOrderAsync(new PurchaseOrderDto());

            // Assert
            Assert.Null(purchaseOrder);
            Assert.True(LocalNotification.HasNotification());
            var message = _localizationSource.GetString(PurchaseOrder.Error.PurchaseOrderMustHaveCustomer, _culture);

            Assert.Contains(LocalNotification.GetAll(), n => n.Message == message);
        }
Ejemplo n.º 27
0
        public void Should_Update_Null_Professional_With_Error()
        {
            // Act
            _professionalAppService.UpdateProfessional(new ComposeKey <Guid, decimal>(Guid.NewGuid(), 1), null);

            // Assert
            Assert.True(LocalNotification.HasNotification());
            var notifications = LocalNotification.GetAll();

            Assert.Equal(notifications.Count(), 1);
            Assert.True(notifications.Any(n => n.Message == Error.InvalidParameter.ToString()));
        }
        public async Task Should_Raise_Notification_On_Update_With_Specifications()
        {
            // Act
            var customer = await _appService.Update(CustomerDomainServiceMock.customerGuid, new CustomerDto());

            // Assert
            Assert.NotNull(customer);
            Assert.True(LocalNotification.HasNotification());
            var message = _localizationSource.GetString(Customer.Error.CustomerShouldHaveName, _culture);

            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);
        }
Ejemplo n.º 30
0
        public async Task Should_Raise_Notification_On_Create()
        {
            // Act
            var product = await _domainService.InsertProductAsync(null);

            // Assert
            Assert.Null(product);
            Assert.True(LocalNotification.HasNotification());
            var message = _localizationSource.GetString(DomainService.Error.DomainServiceOnInsertAndGetIdNullBuilderError, _culture);

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