private static T CreateIfEnabled <T>(MobileServiceFileSyncContextArgs flags, MobileServiceFileSyncContextArgs checkFlag) where T : class { if (flags.HasFlag(checkFlag)) { return(new Mock <T>().Object); } return(null); }
public static MobileServiceFileSyncContextInput CreateWithout(MobileServiceFileSyncContextArgs args) { var arguments = MobileServiceFileSyncContextArgs.All & ~args; var input = new MobileServiceFileSyncContextInput(); input.Client = CreateIfEnabled <IMobileServiceClient>(arguments, MobileServiceFileSyncContextArgs.Client); input.MetadataStore = CreateIfEnabled <IFileMetadataStore>(arguments, MobileServiceFileSyncContextArgs.MetadataStore); input.OperationsQueue = CreateIfEnabled <IFileOperationQueue>(arguments, MobileServiceFileSyncContextArgs.OperationQueue); input.TriggerFactory = CreateIfEnabled <IFileSyncTriggerFactory>(arguments, MobileServiceFileSyncContextArgs.TriggerFactory); input.SyncHandler = CreateIfEnabled <IFileSyncHandler>(arguments, MobileServiceFileSyncContextArgs.FileSyncHandler); input.FilesClient = CreateIfEnabled <IMobileServiceFilesClient>(arguments, MobileServiceFileSyncContextArgs.FilesClient); return(input); }
private MobileServiceFileSyncContext CreateContext(MobileServiceFileSyncContextArgs nullArguments) { MobileServiceFileSyncContextInput input = MobileServiceFileSyncContextInput.CreateWithout(nullArguments); return(CreateContext(input)); }