Esempio 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());
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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());
        }
Esempio 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());
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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()));
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio 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);
        }