public void Test_Create_BedroomModel(BedroomModel bedroom)
        {
            var validationContext = new ValidationContext(bedroom);
            var actual            = Validator.TryValidateObject(bedroom, validationContext, null, true);

            Assert.True(actual);
        }
示例#2
0
        private void RegistrationBedrooms( )
        {
            List <BedroomModel> bedroomModels = new List <BedroomModel>( );

            foreach (var item in Enum.GetValues(typeof(eBedroomType)).Cast <eBedroomType>( ).ToList( ))
            {
                BedroomModel bedroomModel = new BedroomModel( );

                Console.Clear( );

                Console.WriteLine($"Informe a quatidade total de quartos {item.GetDescription( )}:");

                int totalbedrooms = Convert.ToInt32(Console.ReadLine( ));

                Console.Clear( );

                Console.WriteLine($"Informe a quatidade de quartos para reserva {item.GetDescription( )}:");

                int activesBedrooms = Convert.ToInt32(Console.ReadLine( ));

                bedroomModels.Add(new BedroomModel( )
                {
                    Type      = item,
                    Actives   = activesBedrooms,
                    Inactives = totalbedrooms - activesBedrooms
                });
            }

            if (m_BedroomService.Registration(bedroomModels))
            {
                Console.WriteLine("Dados inseridos com sucesso");
            }
        }
        public void Test_Validate_BedroomModel(BedroomModel bedroom)
        {
            var validationContext = new ValidationContext(bedroom);

            Assert.Empty(bedroom.Validate(validationContext));
        }