Exemplo n.º 1
0
    public void SyncShouldNotCrashIfConfigIsNull()
    {
        ConfigurationManager.GeneralConfig = null;

        var package = new GeneralConfigPackage();

        var serialized = package.Pack();

        // Reset stream head, to simulate transfer
        serialized.m_stream.Position = 0L;

        CompressedPackage.Unpack <GeneralConfigPackage>(serialized);
    }
Exemplo n.º 2
0
    public void CanSync()
    {
        try
        {
            ConfigurationManager.GeneralConfig = new GeneralConfiguration();

            var package = new GeneralConfigPackage();

            var serialized = package.Pack();

            ConfigurationManager.GeneralConfig = null;

            // Reset stream head, to simulate transfer
            serialized.m_stream.Position = 0L;

            CompressedPackage.Unpack <GeneralConfigPackage>(serialized);

            Assert.IsNotNull(ConfigurationManager.GeneralConfig);
        }
        finally
        {
            ConfigurationManager.GeneralConfig = null;
        }
    }