public void OpenWeather_NewOpenWeather_IsValid()
        {
            //Arrange
            var openWeather = _weatherTestsFixture.GenerateValidWeather();
            var coordinate  = _weatherTestsFixture.GenerateValidCoordinate();
            var weatherMain = _weatherTestsFixture.GeneratevalidOpenWeatherMain();

            //Act
            var openWeatherResult    = openWeather.Isvalid();
            var addCoordinateResult  = openWeather.AddCoordinate(coordinate);
            var addWeatherMainResult = openWeather.AddWeatherMain(weatherMain);

            //Assert
            Assert.True(openWeatherResult);
            Assert.True(addCoordinateResult.IsValid);
            Assert.True(addWeatherMainResult.IsValid);
            Assert.Equal(0, openWeather.ValidationResult.Errors.Count);
            Assert.Equal(0, addCoordinateResult.Errors.Count);
            Assert.Equal(0, addWeatherMainResult.Errors.Count);
        }
Esempio n. 2
0
        public async Task Generic_AddEntity_MustBeSuccess()
        {
            //Arrange
            //Arrange
            var openWeather = _weatherTestsFixture.GenerateValidWeather();
            var coordinate  = _weatherTestsFixture.GenerateValidCoordinate();
            var weatherMain = _weatherTestsFixture.GeneratevalidOpenWeatherMain();

            //Act
            openWeather.AddCoordinate(coordinate);
            openWeather.AddWeatherMain(weatherMain);

            //Act
            await _repository.AddAsync(openWeather);

            var success = await _repository.UnitOfWork.Commit();

            var item = await _repository.GetByIdAsync(openWeather.Id);

            //Assert
            Assert.True(success);
            Assert.NotNull(item);
            Assert.NotEqual(Guid.Empty, item.Id);
        }