Example #1
0
        public void LogProfileSaveAndReload()
        {
            ParameterDatabase database = this.InitializeLogger();

            LogProfile expectedProfile = LogProfile.CreateInstance();

            foreach (SsmParameter parameter in database.Parameters)
            {
                expectedProfile.Add(parameter, parameter.Conversions[0]);
                if (expectedProfile.Columns.Count > 3)
                {
                    break;
                }
            }

            this.logger.SetProfile(expectedProfile, database);
            expectedProfile.Save("profile.xml");

            LogProfile emptyProfile = LogProfile.CreateInstance();

            this.logger.SetProfile(emptyProfile, database);

            LogProfile loadedProfile = LogProfile.Load("profile.xml", database);

            this.logger.SetProfile(loadedProfile, database);

            LogProfile actualProfile = this.logger.CurrentProfile;

            foreach (LogColumn column in actualProfile.Columns)
            {
                Assert.IsTrue(expectedProfile.Contains(column.Parameter));
            }

            foreach (LogColumn column in expectedProfile.Columns)
            {
                Assert.IsTrue(actualProfile.Contains(column.Parameter));
            }
        }