public void Map_StateUnderTest_ExpectedBehavior_Longitude()
        {
            // Arrange
            DegreeToDecimalLatLongMapper degreeToDecimalLatLongMapper = this.CreateDegreeToDecimalLatLongMapper();
            DataCellCollection           sourceRows = new DataCellCollection();

            sourceRows.Add(new DataCell(new LumenWorks.Framework.IO.Csv.Column()
            {
                Name = Constants.columnkey
            }, "", "3519S 14804E"));

            string             columnkey    = Constants.longitudeKey;
            string             value        = "3519S 14804E";
            DataCellCollection currentState = new DataCellCollection();

            Dictionary <string, string> Context = new Dictionary <string, string>();
            // Act
            List <DataCell> result = degreeToDecimalLatLongMapper.Map(
                sourceRows,
                columnkey,
                value,
                Context,
                currentState);

            // Assert 148.066666666667
            Assert.IsTrue(result.Count == 1);
            Assert.IsTrue(result[0].Value == "148.066666666667");
        }
Exemple #2
0
        public static IServiceCollection MainInjection(this IServiceCollection services)
        {
            services.AddSingleton <IDiskIOHandler, DiskIOHandler>();
            services.AddSingleton <IEtLogger, EtLogger>();
            services.AddSingleton((ctx) => new ConsoleProgressBar());
            services.AddSingleton <IDataCleanerFactory, DataCleanerFactory>();
            services.AddSingleton <IDataSourceFactory, DataSourceFactory>();
            services.AddSingleton <IDataSinkFactory, DataSinkFactory>();
            services.AddTransient <IDataResolver, DataResolver>();
            services.AddTransient <IDataCleanerConfig, DataCleanerConfig>();
            services.AddTransient <IET_Engine, ET_Engine>();
            services.AddTransient((ctx =>
            {
                DegreeToDecimalLatLongMapper latlongMapper = new DegreeToDecimalLatLongMapper(ctx.GetRequiredService <RuntimeArgs>());

                return(new Dictionary <string, IDataMapper>()
                {
                    { latlongMapper.Name, latlongMapper }
                });;
            }));
            services.AddTransient((ctx =>
            {
                return(new Dictionary <string, IDataFilter>());
            }));
            return(services);
        }
        public void GetAssociatedColumns_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            DegreeToDecimalLatLongMapper degreeToDecimalLatLongMapper = this.CreateDegreeToDecimalLatLongMapper();

            // Act
            HashSet <string> result = degreeToDecimalLatLongMapper.GetAssociatedColumns();

            // Assert
            Assert.IsTrue(result.Count == 3);
        }
        public void ConvertDegreeAngleToDouble_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            DegreeToDecimalLatLongMapper degreeToDecimalLatLongMapper = this.CreateDegreeToDecimalLatLongMapper();
            string point = "3519S";

            // Act
            string result = degreeToDecimalLatLongMapper.ConvertDegreeAngleToDouble(
                point);

            // Assert
            Assert.IsTrue(result == "-35.3166666666667");
        }
        public void BindToLookUpCollection_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            DegreeToDecimalLatLongMapper degreeToDecimalLatLongMapper         = this.CreateDegreeToDecimalLatLongMapper();
            Dictionary <string, IDataLookUpCollection> globalLookUpCollection = new Dictionary <string, IDataLookUpCollection>();

            // Act
            try
            {
                degreeToDecimalLatLongMapper.BindToLookUpCollection(
                    globalLookUpCollection);
            }
            catch (Exception)
            {
                // Assert
                //NOP method
                Assert.Fail();
            }
        }