Exemple #1
0
        public void Weps_WriteScenarioFiles_FromVerificationLocations()
        {
            // Arrange
            CsvHandler         reader      = new CsvHandler();
            IBuildErosionModel builder     = new WepsBuilder();
            ScenarioHandler    writer      = new ScenarioHandler();
            string             currentDate = DateTime.Now.ToString("yyyyMMdd");
            string             expectedZip = $"Assets\\output\\weps_{currentDate}.zip";
            string             writePath   = $"Assets\\output\\weps_{currentDate}";

            // Act
            List <string> actual = builder.BuildScenarios(
                reader.ReadCsipLocationFile(@"Assets\location_verification_10.csv"),
                builder.GetTemplate(),
                builder.GetRotations());

            writer.WriteScenariosZip(actual, writePath);

            // Assert
            Assert.True(File.Exists(expectedZip));

            // Cleanup
            if (File.Exists(expectedZip))
            {
                File.Delete(expectedZip);
            }
            if (Directory.Exists(writePath))
            {
                Directory.Delete(writePath, true);
            }
        }
Exemple #2
0
        public void Weps_Build_ValidInput10Locs_ExpectedResult()
        {
            // Arrange
            CsvHandler         reader = new CsvHandler();
            IBuildErosionModel sut    = new WepsBuilder();

            // Act
            List <string> actual = sut.BuildScenarios(
                reader.ReadCsipLocationFile(@"Assets\location_verification_10.csv"),
                sut.GetTemplate(),
                sut.GetRotations());

            // Assert
            Assert.NotNull(actual);
            Assert.Equal(33, actual.Count);
        }
Exemple #3
0
        public void Weps_Build_ValidInput01Loc_ExpectedResult()
        {
            // Arrange
            CsvHandler         reader = new CsvHandler();
            IBuildErosionModel sut    = new WepsBuilder();

            // Act
            List <string> actual = sut.BuildScenarios(
                reader.ReadCsipLocationFile(@"Assets\location_verification_01.csv"),
                sut.GetTemplate(),
                sut.GetRotations());

            // Assert
            string strippedJson = Regex.Replace(actual.FirstOrDefault(), @"\s+", "");

            // assert rectangle lengths, others?
            Assert.Contains("{\"duration\":2,\"length\":350.0", strippedJson);
        }