There are few methods which have Application.Current.Properties and Application.Current.SavePropertiesAsync methods. So how do i test methods having these two in them? I'm stuck after trying to use Unity container for them but its only working for Properties not SavePropertiesAsync. how can i implement it? How i have implemented it is:
public interface IAppProperties { IDictionary<string, object> Properties { get; set; } }
`public class AppProperty:IAppProperties
{
public const string AppPropertiesName = "AppProperties";
public IDictionary<string, object> Properties { get; set; }
public AppProperty(IDictionary<string, object> appProperties)
{
Properties = appProperties;
}
}`
In App xaml.cs
UnityContainer container = new UnityContainer(); if (!IsUnitTestCase) { container.RegisterInstance<IDictionary<string, object>>(AppProperty.AppPropertiesName, Application.Current.Properties); } else { container.RegisterInstance<IDictionary<string, object>>(AppProperty.AppPropertiesName, new Dictionary<string,object>()); } container.RegisterType<IAppProperties,AppProperty>(); Application.Current.Resources.Add("Unity", container);