diff --git a/.gitignore b/.gitignore
index 81ecf33..ab84e3e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,32 +1,39 @@
-#ignore thumbnails created by windows
-Thumbs.db
-#Ignore files build by Visual Studio
-*.obj
-*.exe
-*.pdb
-*.user
-*.aps
-*.pch
-*.vspscc
-*_i.c
-*_p.c
-*.ncb
-*.suo
-*.tlb
-*.tlh
-*.bak
-*.cache
-*.ilk
-*.log
-*.testsettings
-*.log
-[Bb]in
-[Dd]ebug*/
-*.lib
-*.sbr
-obj/
-[Rr]elease*/
-_ReSharper*/
-[Tt]est[Rr]esult*
-download/
-/DropNet.CLI/possantest.bat
\ No newline at end of file
+#ignore thumbnails created by windows
+Thumbs.db
+#Ignore files build by Visual Studio
+*.obj
+*.exe
+*.pdb
+*.user
+*.aps
+*.pch
+*.vspscc
+*_i.c
+*_p.c
+*.ncb
+*.suo
+*.tlb
+*.tlh
+*.bak
+*.cache
+*.ilk
+*.log
+*.testsettings
+*.log
+[Bb]in
+[Dd]ebug*/
+*.lib
+*.sbr
+obj/
+[Rr]elease*/
+_ReSharper*/
+[Tt]est[Rr]esult*
+download/
+/DropNet.CLI/possantest.bat
+*.ncrunchproject
+*.ncrunchsolution
+.DS_Store
+*.pidb
+*.userprefs
+/DropNet.Tests/TestVariables.cs
+/packages
diff --git a/DropNet.CLI.sln b/DropNet.CLI.sln
deleted file mode 100644
index d375b45..0000000
--- a/DropNet.CLI.sln
+++ /dev/null
@@ -1,42 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropNet.CLI", "DropNet.CLI\DropNet.CLI.csproj", "{748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropNet", "DropNet\DropNet.csproj", "{E9580EFC-6014-4D3B-82A8-5F6D57213CE4}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}.Debug|Any CPU.ActiveCfg = Debug|x86
- {748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}.Debug|x86.ActiveCfg = Debug|x86
- {748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}.Debug|x86.Build.0 = Debug|x86
- {748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}.Release|Any CPU.ActiveCfg = Release|x86
- {748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}.Release|Mixed Platforms.Build.0 = Release|x86
- {748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}.Release|x86.ActiveCfg = Release|x86
- {748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}.Release|x86.Build.0 = Release|x86
- {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Debug|x86.ActiveCfg = Debug|Any CPU
- {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Release|Any CPU.Build.0 = Release|Any CPU
- {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Release|x86.ActiveCfg = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/DropNet.CLI/ApplicationDefaults.cs b/DropNet.CLI/ApplicationDefaults.cs
deleted file mode 100644
index 2b0c49a..0000000
--- a/DropNet.CLI/ApplicationDefaults.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-
-namespace DropNet.CLI
-{
- public class ApplicationDefaults
- {
- // DropNet.CLI app registration
- public const string AppKey = "qxh112htz4r9i60";
- public const string AppSecret = "33osupoysq73j39";
- }
-}
diff --git a/DropNet.CLI/DropNet.CLI.csproj b/DropNet.CLI/DropNet.CLI.csproj
deleted file mode 100644
index 3e61863..0000000
--- a/DropNet.CLI/DropNet.CLI.csproj
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
- Debug
- x86
- 8.0.30703
- 2.0
- {748BB6D1-B232-4EEE-8BC6-D6B1BD4FD9BF}
- Exe
- Properties
- DropNet.CLI
- DropNet.CLI
- v3.5
- 512
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
- Client
-
-
- x86
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- x86
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- true
-
-
- False
- Windows Installer 3.1
- true
-
-
-
-
-
-
-
- {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}
- DropNet
-
-
-
-
-
\ No newline at end of file
diff --git a/DropNet.CLI/Mono.Options.cs b/DropNet.CLI/Mono.Options.cs
deleted file mode 100644
index ec6ea18..0000000
--- a/DropNet.CLI/Mono.Options.cs
+++ /dev/null
@@ -1,1101 +0,0 @@
-//
-// Options.cs
-//
-// Authors:
-// Jonathan Pryor
-//
-// Copyright (C) 2008 Novell (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-// Compile With:
-// gmcs -debug+ -r:System.Core Options.cs -o:NDesk.Options.dll
-// gmcs -debug+ -d:LINQ -r:System.Core Options.cs -o:NDesk.Options.dll
-//
-// The LINQ version just changes the implementation of
-// OptionSet.Parse(IEnumerable), and confers no semantic changes.
-
-//
-// A Getopt::Long-inspired option parsing library for C#.
-//
-// NDesk.Options.OptionSet is built upon a key/value table, where the
-// key is a option format string and the value is a delegate that is
-// invoked when the format string is matched.
-//
-// Option format strings:
-// Regex-like BNF Grammar:
-// name: .+
-// type: [=:]
-// sep: ( [^{}]+ | '{' .+ '}' )?
-// aliases: ( name type sep ) ( '|' name type sep )*
-//
-// Each '|'-delimited name is an alias for the associated action. If the
-// format string ends in a '=', it has a required value. If the format
-// string ends in a ':', it has an optional value. If neither '=' or ':'
-// is present, no value is supported. `=' or `:' need only be defined on one
-// alias, but if they are provided on more than one they must be consistent.
-//
-// Each alias portion may also end with a "key/value separator", which is used
-// to split option values if the option accepts > 1 value. If not specified,
-// it defaults to '=' and ':'. If specified, it can be any character except
-// '{' and '}' OR the *string* between '{' and '}'. If no separator should be
-// used (i.e. the separate values should be distinct arguments), then "{}"
-// should be used as the separator.
-//
-// Options are extracted either from the current option by looking for
-// the option name followed by an '=' or ':', or is taken from the
-// following option IFF:
-// - The current option does not contain a '=' or a ':'
-// - The current option requires a value (i.e. not a Option type of ':')
-//
-// The `name' used in the option format string does NOT include any leading
-// option indicator, such as '-', '--', or '/'. All three of these are
-// permitted/required on any named option.
-//
-// Option bundling is permitted so long as:
-// - '-' is used to start the option group
-// - all of the bundled options are a single character
-// - at most one of the bundled options accepts a value, and the value
-// provided starts from the next character to the end of the string.
-//
-// This allows specifying '-a -b -c' as '-abc', and specifying '-D name=value'
-// as '-Dname=value'.
-//
-// Option processing is disabled by specifying "--". All options after "--"
-// are returned by OptionSet.Parse() unchanged and unprocessed.
-//
-// Unprocessed options are returned from OptionSet.Parse().
-//
-// Examples:
-// int verbose = 0;
-// OptionSet p = new OptionSet ()
-// .Add ("v", v => ++verbose)
-// .Add ("name=|value=", v => Console.WriteLine (v));
-// p.Parse (new string[]{"-v", "--v", "/v", "-name=A", "/name", "B", "extra"});
-//
-// The above would parse the argument string array, and would invoke the
-// lambda expression three times, setting `verbose' to 3 when complete.
-// It would also print out "A" and "B" to standard output.
-// The returned array would contain the string "extra".
-//
-// C# 3.0 collection initializers are supported and encouraged:
-// var p = new OptionSet () {
-// { "h|?|help", v => ShowHelp () },
-// };
-//
-// System.ComponentModel.TypeConverter is also supported, allowing the use of
-// custom data types in the callback type; TypeConverter.ConvertFromString()
-// is used to convert the value option to an instance of the specified
-// type:
-//
-// var p = new OptionSet () {
-// { "foo=", (Foo f) => Console.WriteLine (f.ToString ()) },
-// };
-//
-// Random other tidbits:
-// - Boolean options (those w/o '=' or ':' in the option format string)
-// are explicitly enabled if they are followed with '+', and explicitly
-// disabled if they are followed with '-':
-// string a = null;
-// var p = new OptionSet () {
-// { "a", s => a = s },
-// };
-// p.Parse (new string[]{"-a"}); // sets v != null
-// p.Parse (new string[]{"-a+"}); // sets v != null
-// p.Parse (new string[]{"-a-"}); // sets v == null
-//
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Globalization;
-using System.IO;
-using System.Runtime.Serialization;
-using System.Security.Permissions;
-using System.Text;
-using System.Text.RegularExpressions;
-
-#if LINQ
-using System.Linq;
-#endif
-
-#if TEST
-using NDesk.Options;
-#endif
-
-#if NDESK_OPTIONS
-namespace NDesk.Options
-#else
-namespace Mono.Options
-#endif
-{
- public class OptionValueCollection : IList, IList {
-
- List values = new List ();
- OptionContext c;
-
- internal OptionValueCollection (OptionContext c)
- {
- this.c = c;
- }
-
- #region ICollection
- void ICollection.CopyTo (Array array, int index) {(values as ICollection).CopyTo (array, index);}
- bool ICollection.IsSynchronized {get {return (values as ICollection).IsSynchronized;}}
- object ICollection.SyncRoot {get {return (values as ICollection).SyncRoot;}}
- #endregion
-
- #region ICollection
- public void Add (string item) {values.Add (item);}
- public void Clear () {values.Clear ();}
- public bool Contains (string item) {return values.Contains (item);}
- public void CopyTo (string[] array, int arrayIndex) {values.CopyTo (array, arrayIndex);}
- public bool Remove (string item) {return values.Remove (item);}
- public int Count {get {return values.Count;}}
- public bool IsReadOnly {get {return false;}}
- #endregion
-
- #region IEnumerable
- IEnumerator IEnumerable.GetEnumerator () {return values.GetEnumerator ();}
- #endregion
-
- #region IEnumerable
- public IEnumerator GetEnumerator () {return values.GetEnumerator ();}
- #endregion
-
- #region IList
- int IList.Add (object value) {return (values as IList).Add (value);}
- bool IList.Contains (object value) {return (values as IList).Contains (value);}
- int IList.IndexOf (object value) {return (values as IList).IndexOf (value);}
- void IList.Insert (int index, object value) {(values as IList).Insert (index, value);}
- void IList.Remove (object value) {(values as IList).Remove (value);}
- void IList.RemoveAt (int index) {(values as IList).RemoveAt (index);}
- bool IList.IsFixedSize {get {return false;}}
- object IList.this [int index] {get {return this [index];} set {(values as IList)[index] = value;}}
- #endregion
-
- #region IList
- public int IndexOf (string item) {return values.IndexOf (item);}
- public void Insert (int index, string item) {values.Insert (index, item);}
- public void RemoveAt (int index) {values.RemoveAt (index);}
-
- private void AssertValid (int index)
- {
- if (c.Option == null)
- throw new InvalidOperationException ("OptionContext.Option is null.");
- if (index >= c.Option.MaxValueCount)
- throw new ArgumentOutOfRangeException ("index");
- if (c.Option.OptionValueType == OptionValueType.Required &&
- index >= values.Count)
- throw new OptionException (string.Format (
- c.OptionSet.MessageLocalizer ("Missing required value for option '{0}'."), c.OptionName),
- c.OptionName);
- }
-
- public string this [int index] {
- get {
- AssertValid (index);
- return index >= values.Count ? null : values [index];
- }
- set {
- values [index] = value;
- }
- }
- #endregion
-
- public List ToList ()
- {
- return new List (values);
- }
-
- public string[] ToArray ()
- {
- return values.ToArray ();
- }
-
- public override string ToString ()
- {
- return string.Join (", ", values.ToArray ());
- }
- }
-
- public class OptionContext {
- private Option option;
- private string name;
- private int index;
- private OptionSet set;
- private OptionValueCollection c;
-
- public OptionContext (OptionSet set)
- {
- this.set = set;
- this.c = new OptionValueCollection (this);
- }
-
- public Option Option {
- get {return option;}
- set {option = value;}
- }
-
- public string OptionName {
- get {return name;}
- set {name = value;}
- }
-
- public int OptionIndex {
- get {return index;}
- set {index = value;}
- }
-
- public OptionSet OptionSet {
- get {return set;}
- }
-
- public OptionValueCollection OptionValues {
- get {return c;}
- }
- }
-
- public enum OptionValueType {
- None,
- Optional,
- Required,
- }
-
- public abstract class Option {
- string prototype, description;
- string[] names;
- OptionValueType type;
- int count;
- string[] separators;
-
- protected Option (string prototype, string description)
- : this (prototype, description, 1)
- {
- }
-
- protected Option (string prototype, string description, int maxValueCount)
- {
- if (prototype == null)
- throw new ArgumentNullException ("prototype");
- if (prototype.Length == 0)
- throw new ArgumentException ("Cannot be the empty string.", "prototype");
- if (maxValueCount < 0)
- throw new ArgumentOutOfRangeException ("maxValueCount");
-
- this.prototype = prototype;
- this.names = prototype.Split ('|');
- this.description = description;
- this.count = maxValueCount;
- this.type = ParsePrototype ();
-
- if (this.count == 0 && type != OptionValueType.None)
- throw new ArgumentException (
- "Cannot provide maxValueCount of 0 for OptionValueType.Required or " +
- "OptionValueType.Optional.",
- "maxValueCount");
- if (this.type == OptionValueType.None && maxValueCount > 1)
- throw new ArgumentException (
- string.Format ("Cannot provide maxValueCount of {0} for OptionValueType.None.", maxValueCount),
- "maxValueCount");
- if (Array.IndexOf (names, "<>") >= 0 &&
- ((names.Length == 1 && this.type != OptionValueType.None) ||
- (names.Length > 1 && this.MaxValueCount > 1)))
- throw new ArgumentException (
- "The default option handler '<>' cannot require values.",
- "prototype");
- }
-
- public string Prototype {get {return prototype;}}
- public string Description {get {return description;}}
- public OptionValueType OptionValueType {get {return type;}}
- public int MaxValueCount {get {return count;}}
-
- public string[] GetNames ()
- {
- return (string[]) names.Clone ();
- }
-
- public string[] GetValueSeparators ()
- {
- if (separators == null)
- return new string [0];
- return (string[]) separators.Clone ();
- }
-
- protected static T Parse (string value, OptionContext c)
- {
- Type tt = typeof (T);
- bool nullable = tt.IsValueType && tt.IsGenericType &&
- !tt.IsGenericTypeDefinition &&
- tt.GetGenericTypeDefinition () == typeof (Nullable<>);
- Type targetType = nullable ? tt.GetGenericArguments () [0] : typeof (T);
- TypeConverter conv = TypeDescriptor.GetConverter (targetType);
- T t = default (T);
- try {
- if (value != null)
- t = (T) conv.ConvertFromString (value);
- }
- catch (Exception e) {
- throw new OptionException (
- string.Format (
- c.OptionSet.MessageLocalizer ("Could not convert string `{0}' to type {1} for option `{2}'."),
- value, targetType.Name, c.OptionName),
- c.OptionName, e);
- }
- return t;
- }
-
- internal string[] Names {get {return names;}}
- internal string[] ValueSeparators {get {return separators;}}
-
- static readonly char[] NameTerminator = new char[]{'=', ':'};
-
- private OptionValueType ParsePrototype ()
- {
- char type = '\0';
- List seps = new List ();
- for (int i = 0; i < names.Length; ++i) {
- string name = names [i];
- if (name.Length == 0)
- throw new ArgumentException ("Empty option names are not supported.", "prototype");
-
- int end = name.IndexOfAny (NameTerminator);
- if (end == -1)
- continue;
- names [i] = name.Substring (0, end);
- if (type == '\0' || type == name [end])
- type = name [end];
- else
- throw new ArgumentException (
- string.Format ("Conflicting option types: '{0}' vs. '{1}'.", type, name [end]),
- "prototype");
- AddSeparators (name, end, seps);
- }
-
- if (type == '\0')
- return OptionValueType.None;
-
- if (count <= 1 && seps.Count != 0)
- throw new ArgumentException (
- string.Format ("Cannot provide key/value separators for Options taking {0} value(s).", count),
- "prototype");
- if (count > 1) {
- if (seps.Count == 0)
- this.separators = new string[]{":", "="};
- else if (seps.Count == 1 && seps [0].Length == 0)
- this.separators = null;
- else
- this.separators = seps.ToArray ();
- }
-
- return type == '=' ? OptionValueType.Required : OptionValueType.Optional;
- }
-
- private static void AddSeparators (string name, int end, ICollection seps)
- {
- int start = -1;
- for (int i = end+1; i < name.Length; ++i) {
- switch (name [i]) {
- case '{':
- if (start != -1)
- throw new ArgumentException (
- string.Format ("Ill-formed name/value separator found in \"{0}\".", name),
- "prototype");
- start = i+1;
- break;
- case '}':
- if (start == -1)
- throw new ArgumentException (
- string.Format ("Ill-formed name/value separator found in \"{0}\".", name),
- "prototype");
- seps.Add (name.Substring (start, i-start));
- start = -1;
- break;
- default:
- if (start == -1)
- seps.Add (name [i].ToString ());
- break;
- }
- }
- if (start != -1)
- throw new ArgumentException (
- string.Format ("Ill-formed name/value separator found in \"{0}\".", name),
- "prototype");
- }
-
- public void Invoke (OptionContext c)
- {
- OnParseComplete (c);
- c.OptionName = null;
- c.Option = null;
- c.OptionValues.Clear ();
- }
-
- protected abstract void OnParseComplete (OptionContext c);
-
- public override string ToString ()
- {
- return Prototype;
- }
- }
-
- [Serializable]
- public class OptionException : Exception {
- private string option;
-
- public OptionException ()
- {
- }
-
- public OptionException (string message, string optionName)
- : base (message)
- {
- this.option = optionName;
- }
-
- public OptionException (string message, string optionName, Exception innerException)
- : base (message, innerException)
- {
- this.option = optionName;
- }
-
- protected OptionException (SerializationInfo info, StreamingContext context)
- : base (info, context)
- {
- this.option = info.GetString ("OptionName");
- }
-
- public string OptionName {
- get {return this.option;}
- }
-
- [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
- public override void GetObjectData (SerializationInfo info, StreamingContext context)
- {
- base.GetObjectData (info, context);
- info.AddValue ("OptionName", option);
- }
- }
-
- public delegate void OptionAction (TKey key, TValue value);
-
- public class OptionSet : KeyedCollection
- {
- public OptionSet ()
- : this (delegate (string f) {return f;})
- {
- }
-
- public OptionSet (Converter localizer)
- {
- this.localizer = localizer;
- }
-
- Converter localizer;
-
- public Converter MessageLocalizer {
- get {return localizer;}
- }
-
- protected override string GetKeyForItem (Option item)
- {
- if (item == null)
- throw new ArgumentNullException ("option");
- if (item.Names != null && item.Names.Length > 0)
- return item.Names [0];
- // This should never happen, as it's invalid for Option to be
- // constructed w/o any names.
- throw new InvalidOperationException ("Option has no names!");
- }
-
- [Obsolete ("Use KeyedCollection.this[string]")]
- protected Option GetOptionForName (string option)
- {
- if (option == null)
- throw new ArgumentNullException ("option");
- try {
- return base [option];
- }
- catch (KeyNotFoundException) {
- return null;
- }
- }
-
- protected override void InsertItem (int index, Option item)
- {
- base.InsertItem (index, item);
- AddImpl (item);
- }
-
- protected override void RemoveItem (int index)
- {
- base.RemoveItem (index);
- Option p = Items [index];
- // KeyedCollection.RemoveItem() handles the 0th item
- for (int i = 1; i < p.Names.Length; ++i) {
- Dictionary.Remove (p.Names [i]);
- }
- }
-
- protected override void SetItem (int index, Option item)
- {
- base.SetItem (index, item);
- RemoveItem (index);
- AddImpl (item);
- }
-
- private void AddImpl (Option option)
- {
- if (option == null)
- throw new ArgumentNullException ("option");
- List added = new List (option.Names.Length);
- try {
- // KeyedCollection.InsertItem/SetItem handle the 0th name.
- for (int i = 1; i < option.Names.Length; ++i) {
- Dictionary.Add (option.Names [i], option);
- added.Add (option.Names [i]);
- }
- }
- catch (Exception) {
- foreach (string name in added)
- Dictionary.Remove (name);
- throw;
- }
- }
-
- public new OptionSet Add (Option option)
- {
- base.Add (option);
- return this;
- }
-
- sealed class ActionOption : Option {
- Action action;
-
- public ActionOption (string prototype, string description, int count, Action action)
- : base (prototype, description, count)
- {
- if (action == null)
- throw new ArgumentNullException ("action");
- this.action = action;
- }
-
- protected override void OnParseComplete (OptionContext c)
- {
- action (c.OptionValues);
- }
- }
-
- public OptionSet Add (string prototype, Action action)
- {
- return Add (prototype, null, action);
- }
-
- public OptionSet Add (string prototype, string description, Action action)
- {
- if (action == null)
- throw new ArgumentNullException ("action");
- Option p = new ActionOption (prototype, description, 1,
- delegate (OptionValueCollection v) { action (v [0]); });
- base.Add (p);
- return this;
- }
-
- public OptionSet Add (string prototype, OptionAction action)
- {
- return Add (prototype, null, action);
- }
-
- public OptionSet Add (string prototype, string description, OptionAction action)
- {
- if (action == null)
- throw new ArgumentNullException ("action");
- Option p = new ActionOption (prototype, description, 2,
- delegate (OptionValueCollection v) {action (v [0], v [1]);});
- base.Add (p);
- return this;
- }
-
- sealed class ActionOption : Option {
- Action action;
-
- public ActionOption (string prototype, string description, Action action)
- : base (prototype, description, 1)
- {
- if (action == null)
- throw new ArgumentNullException ("action");
- this.action = action;
- }
-
- protected override void OnParseComplete (OptionContext c)
- {
- action (Parse (c.OptionValues [0], c));
- }
- }
-
- sealed class ActionOption : Option {
- OptionAction action;
-
- public ActionOption (string prototype, string description, OptionAction action)
- : base (prototype, description, 2)
- {
- if (action == null)
- throw new ArgumentNullException ("action");
- this.action = action;
- }
-
- protected override void OnParseComplete (OptionContext c)
- {
- action (
- Parse (c.OptionValues [0], c),
- Parse (c.OptionValues [1], c));
- }
- }
-
- public OptionSet Add (string prototype, Action action)
- {
- return Add (prototype, null, action);
- }
-
- public OptionSet Add (string prototype, string description, Action action)
- {
- return Add (new ActionOption (prototype, description, action));
- }
-
- public OptionSet Add (string prototype, OptionAction action)
- {
- return Add (prototype, null, action);
- }
-
- public OptionSet Add (string prototype, string description, OptionAction action)
- {
- return Add (new ActionOption (prototype, description, action));
- }
-
- protected virtual OptionContext CreateOptionContext ()
- {
- return new OptionContext (this);
- }
-
-#if LINQ
- public List Parse (IEnumerable arguments)
- {
- bool process = true;
- OptionContext c = CreateOptionContext ();
- c.OptionIndex = -1;
- var def = GetOptionForName ("<>");
- var unprocessed =
- from argument in arguments
- where ++c.OptionIndex >= 0 && (process || def != null)
- ? process
- ? argument == "--"
- ? (process = false)
- : !Parse (argument, c)
- ? def != null
- ? Unprocessed (null, def, c, argument)
- : true
- : false
- : def != null
- ? Unprocessed (null, def, c, argument)
- : true
- : true
- select argument;
- List r = unprocessed.ToList ();
- if (c.Option != null)
- c.Option.Invoke (c);
- return r;
- }
-#else
- public List Parse (IEnumerable arguments)
- {
- OptionContext c = CreateOptionContext ();
- c.OptionIndex = -1;
- bool process = true;
- List unprocessed = new List ();
- Option def = Contains ("<>") ? this ["<>"] : null;
- foreach (string argument in arguments) {
- ++c.OptionIndex;
- if (argument == "--") {
- process = false;
- continue;
- }
- if (!process) {
- Unprocessed (unprocessed, def, c, argument);
- continue;
- }
- if (!Parse (argument, c))
- Unprocessed (unprocessed, def, c, argument);
- }
- if (c.Option != null)
- c.Option.Invoke (c);
- return unprocessed;
- }
-#endif
-
- private static bool Unprocessed (ICollection extra, Option def, OptionContext c, string argument)
- {
- if (def == null) {
- extra.Add (argument);
- return false;
- }
- c.OptionValues.Add (argument);
- c.Option = def;
- c.Option.Invoke (c);
- return false;
- }
-
- private readonly Regex ValueOption = new Regex (
- @"^(?--|-|/)(?[^:=]+)((?[:=])(?.*))?$");
-
- protected bool GetOptionParts (string argument, out string flag, out string name, out string sep, out string value)
- {
- if (argument == null)
- throw new ArgumentNullException ("argument");
-
- flag = name = sep = value = null;
- Match m = ValueOption.Match (argument);
- if (!m.Success) {
- return false;
- }
- flag = m.Groups ["flag"].Value;
- name = m.Groups ["name"].Value;
- if (m.Groups ["sep"].Success && m.Groups ["value"].Success) {
- sep = m.Groups ["sep"].Value;
- value = m.Groups ["value"].Value;
- }
- return true;
- }
-
- protected virtual bool Parse (string argument, OptionContext c)
- {
- if (c.Option != null) {
- ParseValue (argument, c);
- return true;
- }
-
- string f, n, s, v;
- if (!GetOptionParts (argument, out f, out n, out s, out v))
- return false;
-
- Option p;
- if (Contains (n)) {
- p = this [n];
- c.OptionName = f + n;
- c.Option = p;
- switch (p.OptionValueType) {
- case OptionValueType.None:
- c.OptionValues.Add (n);
- c.Option.Invoke (c);
- break;
- case OptionValueType.Optional:
- case OptionValueType.Required:
- ParseValue (v, c);
- break;
- }
- return true;
- }
- // no match; is it a bool option?
- if (ParseBool (argument, n, c))
- return true;
- // is it a bundled option?
- if (ParseBundledValue (f, string.Concat (n + s + v), c))
- return true;
-
- return false;
- }
-
- private void ParseValue (string option, OptionContext c)
- {
- if (option != null)
- foreach (string o in c.Option.ValueSeparators != null
- ? option.Split (c.Option.ValueSeparators, StringSplitOptions.None)
- : new string[]{option}) {
- c.OptionValues.Add (o);
- }
- if (c.OptionValues.Count == c.Option.MaxValueCount ||
- c.Option.OptionValueType == OptionValueType.Optional)
- c.Option.Invoke (c);
- else if (c.OptionValues.Count > c.Option.MaxValueCount) {
- throw new OptionException (localizer (string.Format (
- "Error: Found {0} option values when expecting {1}.",
- c.OptionValues.Count, c.Option.MaxValueCount)),
- c.OptionName);
- }
- }
-
- private bool ParseBool (string option, string n, OptionContext c)
- {
- Option p;
- string rn;
- if (n.Length >= 1 && (n [n.Length-1] == '+' || n [n.Length-1] == '-') &&
- Contains ((rn = n.Substring (0, n.Length-1)))) {
- p = this [rn];
- string v = n [n.Length-1] == '+' ? option : null;
- c.OptionName = option;
- c.Option = p;
- c.OptionValues.Add (v);
- p.Invoke (c);
- return true;
- }
- return false;
- }
-
- private bool ParseBundledValue (string f, string n, OptionContext c)
- {
- if (f != "-")
- return false;
- for (int i = 0; i < n.Length; ++i) {
- Option p;
- string opt = f + n [i].ToString ();
- string rn = n [i].ToString ();
- if (!Contains (rn)) {
- if (i == 0)
- return false;
- throw new OptionException (string.Format (localizer (
- "Cannot bundle unregistered option '{0}'."), opt), opt);
- }
- p = this [rn];
- switch (p.OptionValueType) {
- case OptionValueType.None:
- Invoke (c, opt, n, p);
- break;
- case OptionValueType.Optional:
- case OptionValueType.Required: {
- string v = n.Substring (i+1);
- c.Option = p;
- c.OptionName = opt;
- ParseValue (v.Length != 0 ? v : null, c);
- return true;
- }
- default:
- throw new InvalidOperationException ("Unknown OptionValueType: " + p.OptionValueType);
- }
- }
- return true;
- }
-
- private static void Invoke (OptionContext c, string name, string value, Option option)
- {
- c.OptionName = name;
- c.Option = option;
- c.OptionValues.Add (value);
- option.Invoke (c);
- }
-
- private const int OptionWidth = 29;
-
- public void WriteOptionDescriptions (TextWriter o)
- {
- foreach (Option p in this) {
- int written = 0;
- if (!WriteOptionPrototype (o, p, ref written))
- continue;
-
- if (written < OptionWidth)
- o.Write (new string (' ', OptionWidth - written));
- else {
- o.WriteLine ();
- o.Write (new string (' ', OptionWidth));
- }
-
- bool indent = false;
- string prefix = new string (' ', OptionWidth+2);
- foreach (string line in GetLines (localizer (GetDescription (p.Description)))) {
- if (indent)
- o.Write (prefix);
- o.WriteLine (line);
- indent = true;
- }
- }
- }
-
- bool WriteOptionPrototype (TextWriter o, Option p, ref int written)
- {
- string[] names = p.Names;
-
- int i = GetNextOptionIndex (names, 0);
- if (i == names.Length)
- return false;
-
- if (names [i].Length == 1) {
- Write (o, ref written, " -");
- Write (o, ref written, names [0]);
- }
- else {
- Write (o, ref written, " --");
- Write (o, ref written, names [0]);
- }
-
- for ( i = GetNextOptionIndex (names, i+1);
- i < names.Length; i = GetNextOptionIndex (names, i+1)) {
- Write (o, ref written, ", ");
- Write (o, ref written, names [i].Length == 1 ? "-" : "--");
- Write (o, ref written, names [i]);
- }
-
- if (p.OptionValueType == OptionValueType.Optional ||
- p.OptionValueType == OptionValueType.Required) {
- if (p.OptionValueType == OptionValueType.Optional) {
- Write (o, ref written, localizer ("["));
- }
- Write (o, ref written, localizer ("=" + GetArgumentName (0, p.MaxValueCount, p.Description)));
- string sep = p.ValueSeparators != null && p.ValueSeparators.Length > 0
- ? p.ValueSeparators [0]
- : " ";
- for (int c = 1; c < p.MaxValueCount; ++c) {
- Write (o, ref written, localizer (sep + GetArgumentName (c, p.MaxValueCount, p.Description)));
- }
- if (p.OptionValueType == OptionValueType.Optional) {
- Write (o, ref written, localizer ("]"));
- }
- }
- return true;
- }
-
- static int GetNextOptionIndex (string[] names, int i)
- {
- while (i < names.Length && names [i] == "<>") {
- ++i;
- }
- return i;
- }
-
- static void Write (TextWriter o, ref int n, string s)
- {
- n += s.Length;
- o.Write (s);
- }
-
- private static string GetArgumentName (int index, int maxIndex, string description)
- {
- if (description == null)
- return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1);
- string[] nameStart;
- if (maxIndex == 1)
- nameStart = new string[]{"{0:", "{"};
- else
- nameStart = new string[]{"{" + index + ":"};
- for (int i = 0; i < nameStart.Length; ++i) {
- int start, j = 0;
- do {
- start = description.IndexOf (nameStart [i], j);
- } while (start >= 0 && j != 0 ? description [j++ - 1] == '{' : false);
- if (start == -1)
- continue;
- int end = description.IndexOf ("}", start);
- if (end == -1)
- continue;
- return description.Substring (start + nameStart [i].Length, end - start - nameStart [i].Length);
- }
- return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1);
- }
-
- private static string GetDescription (string description)
- {
- if (description == null)
- return string.Empty;
- StringBuilder sb = new StringBuilder (description.Length);
- int start = -1;
- for (int i = 0; i < description.Length; ++i) {
- switch (description [i]) {
- case '{':
- if (i == start) {
- sb.Append ('{');
- start = -1;
- }
- else if (start < 0)
- start = i + 1;
- break;
- case '}':
- if (start < 0) {
- if ((i+1) == description.Length || description [i+1] != '}')
- throw new InvalidOperationException ("Invalid option description: " + description);
- ++i;
- sb.Append ("}");
- }
- else {
- sb.Append (description.Substring (start, i - start));
- start = -1;
- }
- break;
- case ':':
- if (start < 0)
- goto default;
- start = i + 1;
- break;
- default:
- if (start < 0)
- sb.Append (description [i]);
- break;
- }
- }
- return sb.ToString ();
- }
-
- private static IEnumerable GetLines (string description)
- {
- if (string.IsNullOrEmpty (description)) {
- yield return string.Empty;
- yield break;
- }
- int length = 80 - OptionWidth - 1;
- int start = 0, end;
- do {
- end = GetLineEnd (start, length, description);
- char c = description [end-1];
- if (char.IsWhiteSpace (c))
- --end;
- bool writeContinuation = end != description.Length && !IsEolChar (c);
- string line = description.Substring (start, end - start) +
- (writeContinuation ? "-" : "");
- yield return line;
- start = end;
- if (char.IsWhiteSpace (c))
- ++start;
- length = 80 - OptionWidth - 2 - 1;
- } while (end < description.Length);
- }
-
- private static bool IsEolChar (char c)
- {
- return !char.IsLetterOrDigit (c);
- }
-
- private static int GetLineEnd (int start, int length, string description)
- {
- int end = System.Math.Min (start + length, description.Length);
- int sep = -1;
- for (int i = start+1; i < end; ++i) {
- if (description [i] == '\n')
- return i+1;
- if (IsEolChar (description [i]))
- sep = i+1;
- }
- if (sep == -1 || end == description.Length)
- return end;
- return sep;
- }
- }
-}
-
diff --git a/DropNet.CLI/Program.cs b/DropNet.CLI/Program.cs
deleted file mode 100644
index e348086..0000000
--- a/DropNet.CLI/Program.cs
+++ /dev/null
@@ -1,306 +0,0 @@
-using System;
-using System.IO;
-using Mono.Options;
-
-namespace DropNet.CLI
-{
- class Program
- {
- static Settings settings;
-
- static void ShowHelpAndExit(bool failexit)
- {
- Console.WriteLine("Usage: DropNet.CLI [OPTIONS] [METHOD] [METHOD ARGUMENTS]");
- Console.WriteLine("\tUploads a file to a dropbox account.");
- Console.WriteLine();
- Console.WriteLine("Examples:");
- Console.WriteLine("\tDropNet.CLI upload localfile.mp3 /music/");
- Console.WriteLine("\tDropNet.CLI upload localfile.mp3 /music/remotefile.mp3");
- Console.WriteLine("\tDropNet.CLI download /music/remotefile.mp3 ~/music");
- Console.WriteLine("\tDropNet.CLI authenticate");
- Console.WriteLine();
- Console.WriteLine("Options:");
- Console.WriteLine("\t-e|--email dropbox account");
- Console.WriteLine("\t-p|--password dropbox password");
- Console.WriteLine("\t-a|--appkey dropbox application key (if other than default)");
- Console.WriteLine("\t-s|--secret dropbox application secret (if other than default)");
- // Console.WriteLine("\t-s|--sandbox use dropbox sandbox");
- Console.WriteLine("\t-h|-?|--help show this help");
- Console.WriteLine();
- Console.WriteLine();
-
- Environment.Exit(failexit ? 1 : 0);
- }
-
- static void ShowErrorHelpAndExit(string errormessage)
- {
- Console.WriteLine("Error: " + errormessage);
- Console.WriteLine();
- ShowHelpAndExit(true);
- }
-
- static void ShowErrorAndExit(string errormessage)
- {
- Console.WriteLine(errormessage);
- Console.WriteLine();
- Environment.Exit(1);
- }
-
- static void RequireUserInfo()
- {
- if (!string.IsNullOrEmpty(settings.Password) && !string.IsNullOrEmpty(settings.Email))
- return;
-
- ShowErrorHelpAndExit("Both email and password required.");
- }
-
- private static object doneSignal = false;
-
- static string CombineURL(string basepath, string path)
- {
- string ret = basepath;
-
- if (!string.IsNullOrEmpty(path))
- {
- if (!ret.EndsWith("/"))
- ret += "/";
-
- if (path.StartsWith("/"))
- ret += path.Substring(1);
- else
- ret += path;
- }
-
- return ret;
- }
-
- static string CombinePaths(string basepath, string path)
- {
- string ret = basepath;
-
- if (!string.IsNullOrEmpty(path))
- {
- if (!ret.EndsWith("" + Path.DirectorySeparatorChar))
- ret += Path.DirectorySeparatorChar;
-
- if (path.StartsWith(""+Path.DirectorySeparatorChar))
- ret += path.Substring(1);
- else
- ret += path;
- }
-
- return ret;
- }
-
- /*
- static void UploadDone(RestResponse resp)
- {
- Console.WriteLine("Upload done.");
- Console.WriteLine(resp.StatusCode);
- Console.WriteLine(resp.Content);
- // Console.WriteLine(resp.Request);
-
- lock (doneSignal)
- {
- Monitor.Pulse(doneSignal);
- }
- }
- */
- /*
- static string GetFinalPath(string remotepath)
- {
- // remotepath = CombineURL(settings.Sandboxed ? "sandbox/" : "dropbox/", remotepath.Trim('/'));
- return remotepath;
- }
- */
- static void Upload(string localfile, string remotepath)
- {
- if (!File.Exists(localfile))
- ShowErrorHelpAndExit(string.Format("Local file not found: {0}", localfile));
-
- var c = CreateAuthenticatedClient(false);
-
- var filename = Path.GetFileName(localfile);
- // remotepath = GetFinalPath(remotepath);
- if (!remotepath.EndsWith("/"))
- {
- filename = Path.GetFileName(remotepath);
- remotepath = Path.GetDirectoryName(remotepath);
- }
-
- Console.WriteLine("Uploading {0} to {1} as {2}...", localfile, remotepath, filename);
-
- byte[] data = null;
- try
- {
- data = File.ReadAllBytes(localfile);
- }
- catch (Exception z)
- {
- Console.WriteLine("Failed to read from file: "+localfile);
- Console.WriteLine(z);
- }
-
- if( data == null )
- return;
-
- Console.WriteLine("Read " + data.Length + " bytes");
-
- // Console.WriteLine("Final path: "+remotepath);
-
- var result = c.UploadFile(remotepath, filename, data);
- if (result)
- {
- Console.WriteLine("Upload successful.");
- }
- else
- {
- Console.WriteLine("Upload failed.");
- }
-
- /*
- doneSignal = new object();
- c.UploadFileAsync(remotepath, filename, data, UploadDone);
- lock (doneSignal)
- {
- Monitor.Wait(doneSignal);
- }*/
- }
-
- static void Download(string remotefile, string localpath)
- {
- if (!Directory.Exists(localpath))
- ShowErrorHelpAndExit(string.Format("Target directory not found: {0}", localpath));
-
- var c = CreateAuthenticatedClient(false);
-
-
- var filename = Path.GetFileName(remotefile);
-
- // var localfile = CombinePaths(localpath, filename);
- if (localpath.EndsWith("" + Path.DirectorySeparatorChar))
- localpath = CombinePaths(localpath, filename);
-
- Console.WriteLine("Downloading {0} to {1}...", remotefile, localpath);
-
- byte[] data = null;
- try
- {
- data = c.GetFile(remotefile);
- }
- catch (Exception z)
- {
- Console.WriteLine("Download failed:");
- Console.WriteLine(z);
- }
-
- if( data == null )
- return;
-
- Console.WriteLine("Got " + data.Length + " bytes");
-
- try
- {
- File.WriteAllBytes(localpath, data);
- Console.WriteLine("Download successful.");
-
- }
- catch (Exception w)
- {
- Console.WriteLine("Failed to write to file: "+localpath);
- Console.WriteLine(w);
- }
- }
-
- private static void Authenticate()
- {
- var c = CreateAuthenticatedClient(true);
- Console.WriteLine("Authenticated as {0}", c.Account_Info().display_name);
- }
-
- private static DropNetClient CreateAuthenticatedClient(bool showsuccessfulinfo)
- {
- RequireUserInfo();
-
- var c = new DropNetClient(settings.ApiKey, settings.Secret);
- try
- {
- var ul = c.Login(settings.Email, settings.Password);
- if (!string.IsNullOrEmpty(ul.Token))
- {
- if (showsuccessfulinfo)
- {
- Console.WriteLine("Authentication successful.");
- Console.WriteLine("\tToken: " + ul.Token);
- Console.WriteLine("\tSecret: " + ul.Secret);
- }
- else
- {
- Console.WriteLine("Authenticated.");
- }
- }
- else
- {
- Console.WriteLine("Authentication failed.");
- }
- }
- catch (Exceptions.DropboxException e)
- {
- Console.WriteLine("Authentication failed.");
- Console.WriteLine(e);
- }
- return c;
- }
-
- static void Main(string[] args)
- {
- settings = new Settings();
- settings.ApiKey = ApplicationDefaults.AppKey;
- settings.Secret = ApplicationDefaults.AppSecret;
-
- var showhelpflag = false;
-
- var opts = new OptionSet {
- { "v|verbose", v => { } },
- { "h|?|help", v => { showhelpflag = v != null; } },
- { "e|email=", v => { settings.Email = v; } },
- { "p|password=", v => { settings.Password = v; } },
- { "a|appkey=", v => { settings.ApiKey = v; } },
- { "s|secret=", v => { settings.Secret = v; } },
- // { "s|sandbox", v => { settings.Sandboxed = true; } }
- };
-
- var extra = opts.Parse(args);
-
- if (showhelpflag)
- ShowHelpAndExit(false);
-
- if (extra.Count == 0)
- ShowErrorHelpAndExit("Nothing to do, no method specified.");
-
- string method = extra[0].ToLower().Trim();
-
- if (method == "upload" || method == "up")
- {
- if (extra.Count != 3)
- ShowErrorHelpAndExit(string.Format("Wrong number of arguments to upload method, {0} specified, {1} required", extra.Count - 1, 2));
-
- Upload(extra[1], extra[2]);
- }
- else if (method == "download" || method == "down")
- {
- if (extra.Count != 3)
- ShowErrorHelpAndExit(string.Format("Wrong number of arguments to download method, {0} specified, {1} required", extra.Count - 1, 2));
-
- Download(extra[1], extra[2]);
- }
- else if (method == "authenticate")
- {
- Authenticate();
- }
- else
- ShowErrorHelpAndExit(string.Format("Unknown method specified: {0}", method));
- }
-
- }
-}
diff --git a/DropNet.CLI/Properties/AssemblyInfo.cs b/DropNet.CLI/Properties/AssemblyInfo.cs
deleted file mode 100644
index 3bbdaff..0000000
--- a/DropNet.CLI/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("DropNet.CLI")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DropNet.CLI")]
-[assembly: AssemblyCopyright("")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("9cc491fa-15a4-41e3-b12d-c4a32288ce4a")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/DropNet.CLI/Settings.cs b/DropNet.CLI/Settings.cs
deleted file mode 100644
index 1a27d32..0000000
--- a/DropNet.CLI/Settings.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace DropNet.CLI
-{
- internal class Settings
- {
- public string ApiKey { get; set; }
- public string Secret { get; set; }
- // public bool Sandboxed { get; set; }
- public string Email { get; set; }
- public string Password { get; set; }
-
- public Settings()
- {
- ApiKey = "";
- Secret = "";
- // Sandboxed = false;
- Email = "";
- Password = "";
- }
- }
-}
\ No newline at end of file
diff --git a/DropNet.CLI/app.config b/DropNet.CLI/app.config
deleted file mode 100644
index e91dbe0..0000000
--- a/DropNet.CLI/app.config
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/DropNet.MonoTouch/DropNet.MonoTouch.csproj b/DropNet.MonoTouch/DropNet.MonoTouch.csproj
index 94a9a98..d937000 100644
--- a/DropNet.MonoTouch/DropNet.MonoTouch.csproj
+++ b/DropNet.MonoTouch/DropNet.MonoTouch.csproj
@@ -1,114 +1,145 @@
-
-
-
- Debug
- iPhoneSimulator
- 9.0.21022
- 2.0
- {32171778-FC7B-4D01-9CF1-F6635DF9984A}
- {E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- Library
- DropNet.MonoTouch
- DropNet.MonoTouch
- 3.2
- 3.0
- v3.5
-
-
- true
- full
- false
- bin\iPhoneSimulator\Debug
- DEBUG;MONOTOUCH
- prompt
- 4
- True
- false
- None
-
-
- none
- false
- bin\iPhoneSimulator\Release
- prompt
- 4
- False
- false
- None
- MONOTOUCH
-
-
- true
- full
- false
- bin\iPhone\Debug
- DEBUG;MONOTOUCH
- prompt
- 4
- True
- false
- iPhone Developer
-
-
- none
- false
- bin\iPhone\Release
- prompt
- 4
- False
- false
- iPhone Developer
- MONOTOUCH
-
-
-
-
-
-
-
- False
- ..\Lib\RestSharp.MonoTouch.dll
-
-
-
-
-
-
-
-
-
-
-
-
- User.Async.cs
-
-
- Files.Async.cs
-
-
- Client.cs
-
-
- DropboxException.cs
-
-
- UserLogin.cs
-
-
- MetaData.cs
-
-
- AccountInfo.cs
-
-
- RequestHelper.cs
-
-
- OAuthAuthenticator.cs
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}
+ Library
+ Properties
+ DropNet
+ DropNet
+ 512
+
+
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ TRACE;DEBUG;FRAMEWORK
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+ ..\Lib\monotouch\RestSharp.MonoTouch.dll
+
+
+
+
+
+
+
+
+ App.config
+
+
+
+
+ Authenticators\OAuthAuthenticator.cs
+
+
+ Client\Client.cs
+
+
+ Client\Files.Async.cs
+
+
+ Client\Files.Sync.cs
+
+
+ Client\Files.Task.cs
+
+
+ Client\User.Async.cs
+
+
+ Client\User.Sync.cs
+
+
+ Exceptions\DropboxException.cs
+
+
+ Extensions\RestClientExtensions.cs
+
+
+ Extensions\StringExtensions.cs
+
+
+ Helpers\RequestHelper.cs
+
+
+ Models\AccountInfo.cs
+
+
+ Models\DeltaPage.cs
+
+
+ Models\MetaData.cs
+
+
+ Models\SharesResponse.cs
+
+
+ Models\ThumbnailSize.cs
+
+
+ Models\UserLogin.cs
+
+
+ Properties\AssemblyInfo.cs
+
+
+ Models\ChunkedUpload.cs
+
+
+ Models\CopyRefResponse.cs
+
+
+ Models\OAuth2AccessToken.cs
+
+
+ Authenticators\OAuth2Authenticator.cs
+
+
+
diff --git a/DropNet.MonoTouch/DropNet.MonoTouch.pidb b/DropNet.MonoTouch/DropNet.MonoTouch.pidb
new file mode 100644
index 0000000..e4f01d9
Binary files /dev/null and b/DropNet.MonoTouch/DropNet.MonoTouch.pidb differ
diff --git a/DropNet.MonoTouch/DropNet.MonoTouch.sln b/DropNet.MonoTouch/DropNet.MonoTouch.sln
index e8d671e..b7b5229 100644
--- a/DropNet.MonoTouch/DropNet.MonoTouch.sln
+++ b/DropNet.MonoTouch/DropNet.MonoTouch.sln
@@ -1,26 +1,20 @@
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropNet.MonoTouch", "DropNet.MonoTouch.csproj", "{32171778-FC7B-4D01-9CF1-F6635DF9984A}"
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropNet.MonoTouch", "DropNet.MonoTouch.csproj", "{E9580EFC-6014-4D3B-82A8-5F6D57213CE4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|iPhoneSimulator = Debug|iPhoneSimulator
- Release|iPhoneSimulator = Release|iPhoneSimulator
- Debug|iPhone = Debug|iPhone
- Release|iPhone = Release|iPhone
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {32171778-FC7B-4D01-9CF1-F6635DF9984A}.Debug|iPhone.ActiveCfg = Debug|iPhone
- {32171778-FC7B-4D01-9CF1-F6635DF9984A}.Debug|iPhone.Build.0 = Debug|iPhone
- {32171778-FC7B-4D01-9CF1-F6635DF9984A}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
- {32171778-FC7B-4D01-9CF1-F6635DF9984A}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
- {32171778-FC7B-4D01-9CF1-F6635DF9984A}.Release|iPhone.ActiveCfg = Release|iPhone
- {32171778-FC7B-4D01-9CF1-F6635DF9984A}.Release|iPhone.Build.0 = Release|iPhone
- {32171778-FC7B-4D01-9CF1-F6635DF9984A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
- {32171778-FC7B-4D01-9CF1-F6635DF9984A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
+ {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E9580EFC-6014-4D3B-82A8-5F6D57213CE4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- StartupItem = DropNet.MonoTouch.csproj
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
diff --git a/DropNet.MonoTouch/Properties/AssemblyInfo.cs b/DropNet.MonoTouch/Properties/AssemblyInfo.cs
deleted file mode 100644
index 10a61b4..0000000
--- a/DropNet.MonoTouch/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("DropNet.MonoTouch")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DropNet.MonoTouch")]
-[assembly: AssemblyCopyright("")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("EA061A96-ACE3-4C5E-B737-19DD0396A2EA")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/DropNet.MonoTouch/Resource.Designer.cs b/DropNet.MonoTouch/Resource.Designer.cs
deleted file mode 100644
index 0045164..0000000
--- a/DropNet.MonoTouch/Resource.Designer.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace DropNet {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resource {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resource() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DropNet.Resource", typeof(Resource).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized string similar to http://api.dropbox.com.
- ///
- internal static string ApiBaseUrl {
- get {
- return "http://api.dropbox.com";
- }
- }
-
- ///
- /// Looks up a localized string similar to http://api-content.dropbox.com.
- ///
- internal static string ApiContentBaseUrl {
- get {
- return "http://api-content.dropbox.com";
- }
- }
-
- ///
- /// Looks up a localized string similar to https://api.getdropbox.com.
- ///
- internal static string SecureLoginBaseUrl {
- get {
- return "https://api.getdropbox.com";
- }
- }
- }
-}
diff --git a/DropNet.MonoTouch/Resource.resources b/DropNet.MonoTouch/Resource.resources
deleted file mode 100644
index 38b946c..0000000
Binary files a/DropNet.MonoTouch/Resource.resources and /dev/null differ
diff --git a/DropNet.MonoTouch/Resource.resx b/DropNet.MonoTouch/Resource.resx
deleted file mode 100644
index a8f5667..0000000
--- a/DropNet.MonoTouch/Resource.resx
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- http://api.dropbox.com
-
-
- http://api-content.dropbox.com
-
-
- https://api.getdropbox.com
-
-
\ No newline at end of file
diff --git a/DropNet.Tests/DropNet.Tests.csproj b/DropNet.Tests/DropNet.Tests.csproj
index 2f22bc6..cca1de4 100644
--- a/DropNet.Tests/DropNet.Tests.csproj
+++ b/DropNet.Tests/DropNet.Tests.csproj
@@ -14,6 +14,7 @@
v4.0512{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ true
@@ -37,14 +38,11 @@
..\Lib\Moq.dll
-
- ..\Lib\Newtonsoft.Json.dll
- ..\Lib\Ploeh.AutoFixture.dll
-
- ..\Lib\RestSharp.dll
+
+ ..\packages\RestSharp.104.1\lib\net4\RestSharp.dll
@@ -62,11 +60,14 @@
-
+
+
+
+
-
+
@@ -74,13 +75,16 @@
DropNet
-
+
+
+
+
-
\ No newline at end of file
diff --git a/DropNet.Tests/FileAsyncTests.cs b/DropNet.Tests/FileAsyncTests.cs
new file mode 100644
index 0000000..707224a
--- /dev/null
+++ b/DropNet.Tests/FileAsyncTests.cs
@@ -0,0 +1,166 @@
+using System.IO;
+using System.Threading;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Ploeh.AutoFixture;
+using DropNet.Exceptions;
+using DropNet.Models;
+
+namespace DropNet.Tests
+{
+ [TestClass]
+ public class FileAsyncTests
+ {
+ readonly DropNetClient _client;
+ readonly Fixture _fixture;
+
+ public FileAsyncTests()
+ {
+ _client = new DropNetClient(TestVariables.ApiKey, TestVariables.ApiSecret);
+ _client.UserLogin = new Models.UserLogin { Token = TestVariables.Token, Secret = TestVariables.Secret };
+
+ _fixture = new Fixture();
+ }
+
+ [TestMethod]
+ public void Can_Get_MetaData_With_Special_Char_Async()
+ {
+ _client.GetMetaDataAsync("/Temp/test'.txt",
+ Assert.IsNotNull,
+ Assert.IsNull);
+ }
+
+ [TestMethod]
+ public void Can_Get_List_Of_Metadata_For_Search_String()
+ {
+ _client.SearchAsync("Getting", s =>
+ {
+ Assert.IsNotNull(s);
+ Assert.AreEqual(1, s.Count);
+ },
+ Assert.IsNull);
+ }
+
+ [TestMethod]
+ public void Can_Upload_File_Async()
+ {
+ var localFile = new FileInfo(_fixture.CreateAnonymous());
+ var localContent = _fixture.CreateAnonymous();
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ _client.UploadFileAsync("/Test", localFile.Name, content, Can_Upload_File_Async_Success, Can_Upload_File_Async_Failure);
+ }
+
+ [TestMethod]
+ public void Can_Upload_File_Async_International_Char()
+ {
+ var localFile = new FileInfo(_fixture.CreateAnonymous());
+ var localContent = _fixture.CreateAnonymous();
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ _client.UploadFileAsync("/Test", "testПр1.txt", content, Can_Upload_File_Async_Success, Can_Upload_File_Async_Failure);
+ }
+
+ [TestMethod]
+ public void Can_Upload_File_Async_Streaming()
+ {
+ var localFile = new FileInfo(_fixture.CreateAnonymous());
+ var localContent = _fixture.CreateAnonymous();
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ var waitForUploadFinished = new ManualResetEvent(false);
+ using (var fileStream = localFile.OpenRead())
+ {
+ _client.UploadFileAsync("/Test", localFile.Name, fileStream,
+ response =>
+ {
+ Can_Upload_File_Async_Success(response);
+ waitForUploadFinished.Set();
+ },
+ response =>
+ {
+ Can_Upload_File_Async_Failure(response);
+ waitForUploadFinished.Set();
+ });
+ waitForUploadFinished.WaitOne();
+ }
+
+ //TODO - Delete
+ }
+
+ private void Can_Upload_File_Async_Success(MetaData metadata)
+ {
+ Assert.IsNotNull(metadata);
+ }
+ private void Can_Upload_File_Async_Failure(DropboxException error)
+ {
+ Assert.IsTrue(false);
+ }
+
+ [TestMethod]
+ public void Can_Upload_Large_File_Async()
+ {
+ var localFile = new FileInfo(_fixture.CreateAnonymous());
+ var localContent = _fixture.CreateAnonymous();
+
+ for (int i = 0; i < 16; i++)
+ {
+ localContent += localContent;
+ }
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ _client.UploadFileAsync("/Test", localFile.Name, content, Can_Upload_Large_File_Async_Success, Can_Upload_Large_File_Async_Failure);
+
+ //TODO - Delete
+ }
+
+ private void Can_Upload_Large_File_Async_Success(MetaData metadata)
+ {
+ Assert.IsNotNull(metadata);
+ }
+ private void Can_Upload_Large_File_Async_Failure(DropboxException error)
+ {
+ Assert.IsTrue(false);
+ }
+
+ [TestMethod]
+ public void Can_Shares_Async()
+ {
+ _client.GetShareAsync("/Test/Getting Started.rtf", response =>
+ {
+ },
+ error =>
+ {
+ });
+ }
+
+ [TestMethod]
+ public void Can_Get_Thumbnail_Async()
+ {
+ _client.GetThumbnailAsync("/Temp/Test.png", Can_Get_Thumbnail_Async_Success, Can_Get_Thumbnail_Async_Failure);
+ }
+
+ public void Can_Get_Thumbnail_Async_Success(byte[] rawBytes)
+ {
+ Assert.IsNotNull(rawBytes);
+ //Save to disk for validation
+ File.WriteAllBytes(@"C:\Temp\Test.png", rawBytes);
+ }
+ private void Can_Get_Thumbnail_Async_Failure(DropboxException error)
+ {
+ Assert.IsTrue(false);
+ }
+
+ }
+}
diff --git a/DropNet.Tests/FileSyncTests.cs b/DropNet.Tests/FileSyncTests.cs
new file mode 100644
index 0000000..73f7144
--- /dev/null
+++ b/DropNet.Tests/FileSyncTests.cs
@@ -0,0 +1,242 @@
+using System.IO;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Ploeh.AutoFixture;
+using System;
+
+namespace DropNet.Tests
+{
+ ///
+ /// Summary description for UnitTest1
+ ///
+ [TestClass]
+ public class FileSyncTests
+ {
+ readonly DropNetClient _client;
+ readonly Fixture _fixture;
+
+ public FileSyncTests()
+ {
+ _client = new DropNetClient(TestVariables.ApiKey, TestVariables.ApiSecret);
+ _client.UserLogin = new Models.UserLogin { Token = TestVariables.Token, Secret = TestVariables.Secret };
+
+ _fixture = new Fixture();
+ }
+
+ [TestMethod]
+ public void Can_Get_MetaData_With_Special_Char()
+ {
+ var fileInfo = _client.GetMetaData("/Test/Getting'Started.rtf", null);
+
+ Assert.IsNotNull(fileInfo);
+ }
+
+ [TestMethod]
+ public void Search()
+ {
+ var result = _client.Search("Getting", string.Empty);
+ Assert.IsNotNull(result);
+ Assert.IsTrue(result.Count > 0, "List is empty");
+ }
+
+
+ [TestMethod]
+ public void Can_Get_File()
+ {
+ var fileInfo = _client.GetFile("/Test/Getting Started.rtf");
+
+ Assert.IsNotNull(fileInfo);
+ }
+
+ [TestMethod]
+ public void Can_Get_File_Foreign_Language()
+ {
+ var rawBytes = _client.GetFile("/Test/привет.txt");
+
+ Assert.IsNotNull(rawBytes);
+
+ File.WriteAllBytes(@"C:\Temp\привет.txt", rawBytes);
+ }
+
+ [TestMethod]
+ public void Can_Get_File_And_Save()
+ {
+ var fileInfo = _client.GetFile("/Test/Getting Started.rtf");
+
+ var writeStream = new FileStream("C:\\Temp\\Getting Started.rtf", FileMode.Create, FileAccess.Write);
+
+ writeStream.Write(fileInfo, 0, fileInfo.Length);
+ writeStream.Close();
+
+ Assert.IsNotNull(fileInfo);
+ }
+
+ [TestMethod]
+ public void Can_Upload_File_PUT()
+ {
+ var localFile = new FileInfo(_fixture.CreateAnonymous() + ".txt");
+ var localContent = _fixture.CreateAnonymous();
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ var uploaded = _client.UploadFilePUT("/Test", localFile.Name, content);
+
+ Assert.IsNotNull(uploaded);
+ File.Delete(localFile.FullName);
+ }
+
+ [TestMethod]
+ public void Can_Upload_File()
+ {
+ var localFile = new FileInfo(_fixture.CreateAnonymous() + ".txt");
+ var localContent = _fixture.CreateAnonymous();
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ var uploaded = _client.UploadFile("/Test", localFile.Name, content);
+
+ Assert.IsNotNull(uploaded);
+ File.Delete(localFile.FullName);
+ }
+
+ [TestMethod]
+ public void Can_Upload_File_With_Special_Char()
+ {
+ var localFile = new FileInfo(_fixture.CreateAnonymous());
+ var localContent = _fixture.CreateAnonymous();
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ var uploaded = _client.UploadFile("/Test", "testfile's.txt", content);
+
+ Assert.IsNotNull(uploaded);
+ File.Delete(localFile.FullName);
+ }
+
+ [TestMethod]
+ public void Can_Upload_File_With_International_Char()
+ {
+ var localFile = new FileInfo(_fixture.CreateAnonymous());
+ var localContent = _fixture.CreateAnonymous();
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ var uploaded = _client.UploadFile("/Test", "testПр.txt", content);
+
+ Assert.IsNotNull(uploaded);
+ File.Delete(localFile.FullName);
+ }
+
+ [TestMethod]
+ public void Can_Upload_1MB_File()
+ {
+ var localFile = new FileInfo(_fixture.CreateAnonymous());
+ var localContent = _fixture.CreateAnonymous();
+
+ //Make a 1MB file...
+ for (int i = 0; i < 15; i++)
+ {
+ localContent += localContent;
+ }
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ var uploaded = _client.UploadFile("/Test", localFile.Name, content);
+
+ Assert.IsNotNull(uploaded);
+ File.Delete(localFile.FullName);
+ }
+
+ [TestMethod]
+ public void Can_Delete_File()
+ {
+ var filename = string.Format("TestDelete{0:yyyyMMddhhmmss}.txt", DateTime.Now);
+ var uploaded = _client.UploadFile("/Test", filename, new byte[] { 12, 34, 29, 18 });
+ var deleted = _client.Delete("/Test/" + filename);
+
+ Assert.IsNotNull(deleted);
+ }
+
+ [TestMethod]
+ public void Can_Get_MetaData()
+ {
+ var metaData = _client.GetMetaData("/Public", null);
+
+ Assert.IsNotNull(metaData);
+ Assert.IsNotNull(metaData.Contents);
+ }
+
+ [TestMethod]
+ public void Can_Get_MetaData_Root()
+ {
+ var metaData = _client.GetMetaData();
+
+ Assert.IsNotNull(metaData);
+ Assert.IsNotNull(metaData.Contents);
+ }
+
+ [TestMethod]
+ public void Can_Create_Folder()
+ {
+ var metaData = _client.CreateFolder(string.Format("Test/TestFolder1{0:yyyyMMddhhmmss}", DateTime.Now));
+
+ Assert.IsNotNull(metaData);
+ }
+
+ [TestMethod]
+ public void Can_Shares()
+ {
+ var shareResponse = _client.GetShare("/Test/Getting Started.rtf");
+
+ Assert.IsNotNull(shareResponse);
+ Assert.IsNotNull(shareResponse.Url);
+ }
+
+ [TestMethod]
+ public void Can_Shares_Long()
+ {
+ var shareResponse = _client.GetShare("/Test/Getting Started.rtf", false);
+
+ Assert.IsNotNull(shareResponse);
+ Assert.IsNotNull(shareResponse.Url);
+ }
+
+ [TestMethod]
+ public void Can_Get_Thumbnail()
+ {
+ var rawBytes = _client.GetThumbnail("/Temp/Test.png");
+
+ Assert.IsNotNull(rawBytes);
+
+ File.WriteAllBytes(@"C:\Temp\Test.png", rawBytes);
+ }
+
+ [TestMethod]
+ public void Can_Get_Media()
+ {
+ var mediaLink = _client.GetMedia("/Test/WP_20120111_011610Z.mp4");
+
+ Assert.IsNotNull(mediaLink);
+ Assert.IsNotNull(mediaLink.Expires);
+ Assert.IsNotNull(mediaLink.Url);
+ }
+
+ [TestMethod]
+ public void Can_Get_Delta()
+ {
+ var delta = _client.GetDelta("", "", "", false);
+
+ Assert.IsNotNull(delta);
+ }
+
+ }
+}
diff --git a/DropNet.Tests/FileTaskTests.cs b/DropNet.Tests/FileTaskTests.cs
new file mode 100644
index 0000000..899e0d3
--- /dev/null
+++ b/DropNet.Tests/FileTaskTests.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Ploeh.AutoFixture;
+
+namespace DropNet.Tests
+{
+ [TestClass]
+ public class FileTaskTests
+ {
+ readonly DropNetClient _client;
+ readonly Fixture _fixture;
+
+ public FileTaskTests()
+ {
+ _client = new DropNetClient(TestVariables.ApiKey, TestVariables.ApiSecret);
+ _client.UserLogin = new Models.UserLogin { Token = TestVariables.Token, Secret = TestVariables.Secret };
+
+ _fixture = new Fixture();
+ }
+
+ [TestMethod]
+ public void Task_Get_MetaData()
+ {
+ var path = "/Test";
+ var metaTask = _client.GetMetaDataTask(path, null);
+
+ metaTask.Wait();
+
+ Assert.IsNotNull(metaTask.Result);
+ Assert.IsNotNull(metaTask.Result.Contents);
+ Assert.AreEqual(0, string.Compare(path, metaTask.Result.Path, true));
+ }
+
+ [TestMethod]
+ public void Task_Get_MetaData_With_Special_Char()
+ {
+ var path = "/Test/Getting'Started.rtf";
+ var metaTask = _client.GetMetaDataTask(path, null);
+
+ metaTask.Wait();
+
+ Assert.IsNotNull(metaTask.Result);
+ Assert.AreEqual(0, string.Compare(path, metaTask.Result.Path, true));
+ }
+
+ [TestMethod]
+ public void Can_Get_Media()
+ {
+ var mediaTask = _client.GetMediaTask("/Test/WP_20120405_075015Z.mp4");
+
+ mediaTask.Wait();
+
+ Assert.IsNotNull(mediaTask.Result);
+ Assert.IsNotNull(mediaTask.Result.Expires);
+ Assert.IsNotNull(mediaTask.Result.Url);
+ }
+
+ }
+}
diff --git a/DropNet.Tests/FileTests.cs b/DropNet.Tests/FileTests.cs
deleted file mode 100644
index 4aa6aaa..0000000
--- a/DropNet.Tests/FileTests.cs
+++ /dev/null
@@ -1,167 +0,0 @@
-using System.IO;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-using Ploeh.AutoFixture;
-
-namespace DropNet.Tests
-{
- ///
- /// Summary description for UnitTest1
- ///
- [TestClass]
- public class FileTests
- {
- DropNetClient _client;
- Fixture fixture;
- public FileTests()
- {
- //
- // TODO: Add constructor logic here
- //
- _client = new DropNetClient(TestVariables.ApiKey, TestVariables.ApiSecret);
- fixture = new Fixture();
- }
-
- private TestContext testContextInstance;
-
- ///
- ///Gets or sets the test context which provides
- ///information about and functionality for the current test run.
- ///
- public TestContext TestContext
- {
- get
- {
- return testContextInstance;
- }
- set
- {
- testContextInstance = value;
- }
- }
-
- #region Additional test attributes
- //
- // You can use the following additional attributes as you write your tests:
- //
- // Use ClassInitialize to run code before running the first test in the class
- // [ClassInitialize()]
- // public static void MyClassInitialize(TestContext testContext) { }
- //
- // Use ClassCleanup to run code after all tests in a class have run
- // [ClassCleanup()]
- // public static void MyClassCleanup() { }
- //
- // Use TestInitialize to run code before running each test
- // [TestInitialize()]
- // public void MyTestInitialize() { }
- //
- // Use TestCleanup to run code after each test has run
- // [TestCleanup()]
- // public void MyTestCleanup() { }
- //
- #endregion
-
- [TestMethod]
- public void Can_Get_File()
- {
- _client.Login(TestVariables.Email, TestVariables.Password);
- var fileInfo = _client.GetFile("/Getting Started.rtf");
-
- Assert.IsNotNull(fileInfo);
- }
-
- [TestMethod]
- public void Can_Get_File_And_Save()
- {
- _client.Login(TestVariables.Email, TestVariables.Password);
- var fileInfo = _client.GetFile("/Temp/ScreenShot11.Png");
-
- var writeStream = new FileStream("C:\\Temp\\ScreenShot11.Png", FileMode.Create, FileAccess.Write);
-
- writeStream.Write(fileInfo, 0, fileInfo.Length);
- writeStream.Close();
-
- Assert.IsNotNull(fileInfo);
- }
-
- [TestMethod]
- public void Can_Upload_File()
- {
- _client.Login(TestVariables.Email, TestVariables.Password);
-
- var localFile = new FileInfo(fixture.CreateAnonymous());
- var localContent = fixture.CreateAnonymous();
-
- File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
- Assert.IsTrue(File.Exists(localFile.FullName));
- byte[] content = _client.GetFileContentFromFS(localFile);
-
- var uploaded = _client.UploadFile("/", localFile.Name, content);
-
- Assert.IsTrue(uploaded);
- File.Delete(localFile.FullName);
- }
-
- [TestMethod]
- public void Can_Upload_File_Async()
- {
- _client.Login(TestVariables.Email, TestVariables.Password);
-
- var localFile = new FileInfo(fixture.CreateAnonymous());
- var localContent = fixture.CreateAnonymous();
-
- File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
- Assert.IsTrue(File.Exists(localFile.FullName));
- byte[] content = _client.GetFileContentFromFS(localFile);
-
- _client.UploadFileAsync("/", localFile.Name, content, Can_Upload_File_Async_Callback);
-
- //TODO - Delete
- }
-
- private void Can_Upload_File_Async_Callback(RestSharp.RestResponse response)
- {
- Assert.IsTrue(response.StatusCode == System.Net.HttpStatusCode.OK);
- }
-
- [TestMethod]
- public void Can_Delete_File()
- {
- _client.Login(TestVariables.Email, TestVariables.Password);
- var deleted = _client.Delete("/Test.txt");
-
- Assert.IsNotNull(deleted);
- }
-
- [TestMethod]
- public void Can_Get_MetaData()
- {
- _client.Login(TestVariables.Email, TestVariables.Password);
- var metaData = _client.GetMetaData("/Public");
-
- Assert.IsNotNull(metaData);
- Assert.IsNotNull(metaData.Contents);
- }
-
- [TestMethod]
- public void Can_Get_MetaData_Root()
- {
- _client.Login(TestVariables.Email, TestVariables.Password);
- var metaData = _client.GetMetaData();
-
- Assert.IsNotNull(metaData);
- Assert.IsNotNull(metaData.Contents);
- }
-
- [TestMethod]
- public void Can_Create_Folder()
- {
- _client.Login(TestVariables.Email, TestVariables.Password);
- var metaData = _client.CreateFolder("TestFolder1");
-
- Assert.IsNotNull(metaData);
- }
-
- }
-}
diff --git a/DropNet.Tests/FileTests1.Sandbox.cs b/DropNet.Tests/FileTests1.Sandbox.cs
new file mode 100644
index 0000000..1c922ae
--- /dev/null
+++ b/DropNet.Tests/FileTests1.Sandbox.cs
@@ -0,0 +1,216 @@
+using System.IO;
+using System.Threading;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Ploeh.AutoFixture;
+using DropNet.Exceptions;
+using System;
+
+namespace DropNet.Tests
+{
+ ///
+ /// Summary description for UnitTest1
+ ///
+ [TestClass]
+ public class FileTests_Sandbox
+ {
+ DropNetClient _client;
+ Fixture fixture;
+
+ public FileTests_Sandbox()
+ {
+ _client = new DropNetClient(TestVariables.ApiKey_Sandbox, TestVariables.ApiSecret_Sandbox);
+ _client.UserLogin = new Models.UserLogin { Token = TestVariables.Token_Sandbox, Secret = TestVariables.Secret_Sandbox };
+ _client.UseSandbox = true;
+
+ fixture = new Fixture();
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Get_MetaData_With_Special_Char()
+ {
+ var fileInfo = _client.GetMetaData("/test'.txt", null);
+
+ Assert.IsNotNull(fileInfo);
+ }
+
+
+ [TestMethod]
+ public void SANDBOX_Can_Get_File()
+ {
+ var fileInfo = _client.GetFile("/Sandbox.rtf");
+
+ Assert.IsNotNull(fileInfo);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Get_File_Foreign_Language()
+ {
+ var rawBytes = _client.GetFile("/привет1.txt");
+
+ Assert.IsNotNull(rawBytes);
+
+ File.WriteAllBytes(@"C:\Temp\привет1.txt", rawBytes);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Get_File_And_Save()
+ {
+ var fileInfo = _client.GetFile("/Sandbox.rtf");
+
+ var writeStream = new FileStream("C:\\Temp\\Sandbox.rtf", FileMode.Create, FileAccess.Write);
+
+ writeStream.Write(fileInfo, 0, fileInfo.Length);
+ writeStream.Close();
+
+ Assert.IsNotNull(fileInfo);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Upload_File_PUT()
+ {
+ var localFile = new FileInfo(fixture.CreateAnonymous() + ".txt");
+ var localContent = fixture.CreateAnonymous();
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ var uploaded = _client.UploadFilePUT("/", localFile.Name, content);
+
+ Assert.IsNotNull(uploaded);
+ File.Delete(localFile.FullName);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Upload_File()
+ {
+ var localFile = new FileInfo(fixture.CreateAnonymous() + ".txt");
+ var localContent = fixture.CreateAnonymous();
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ var uploaded = _client.UploadFile("/", localFile.Name, content);
+
+ Assert.IsNotNull(uploaded);
+ File.Delete(localFile.FullName);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Upload_File_With_Special_Char()
+ {
+ var localFile = new FileInfo(fixture.CreateAnonymous());
+ var localContent = fixture.CreateAnonymous();
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ var uploaded = _client.UploadFile("/", "testfile's.txt", content);
+
+ Assert.IsNotNull(uploaded);
+ File.Delete(localFile.FullName);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Upload_File_With_International_Char()
+ {
+ var localFile = new FileInfo(fixture.CreateAnonymous());
+ var localContent = fixture.CreateAnonymous();
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ var uploaded = _client.UploadFile("/", "testПр.txt", content);
+
+ Assert.IsNotNull(uploaded);
+ File.Delete(localFile.FullName);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Upload_1MB_File()
+ {
+ var localFile = new FileInfo(fixture.CreateAnonymous());
+ var localContent = fixture.CreateAnonymous();
+
+ //Make a 1MB file...
+ for (int i = 0; i < 15; i++)
+ {
+ localContent += localContent;
+ }
+
+ File.WriteAllText(localFile.FullName, localContent, System.Text.Encoding.UTF8);
+ Assert.IsTrue(File.Exists(localFile.FullName));
+ byte[] content = _client.GetFileContentFromFS(localFile);
+
+ var uploaded = _client.UploadFile("/", localFile.Name, content);
+
+ Assert.IsNotNull(uploaded);
+ File.Delete(localFile.FullName);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Delete_File()
+ {
+ var deleted = _client.Delete("/Test.txt");
+
+ Assert.IsNotNull(deleted);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Get_MetaData()
+ {
+ var metaData = _client.GetMetaData("/", null);
+
+ Assert.IsNotNull(metaData);
+ Assert.IsNotNull(metaData.Contents);
+ Assert.AreEqual("app_folder", metaData.Root);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Get_MetaData_Root()
+ {
+ var metaData = _client.GetMetaData();
+
+ Assert.IsNotNull(metaData);
+ Assert.IsNotNull(metaData.Contents);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Create_Folder()
+ {
+ var metaData = _client.CreateFolder(string.Format("TestFolder1{0:yyyyMMddhhmmss}", DateTime.Now));
+
+ Assert.IsNotNull(metaData);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Shares()
+ {
+ _client.GetShare("/Sandbox.rtf");
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Get_Thumbnail()
+ {
+ var rawBytes = _client.GetThumbnail("/Test.png");
+
+ Assert.IsNotNull(rawBytes);
+
+ File.WriteAllBytes(@"C:\Temp\TestSandbox.png", rawBytes);
+ }
+
+ [TestMethod]
+ public void SANDBOX_Can_Get_Delta()
+ {
+ var deltaPage = _client.GetDelta("", "", "", false);
+
+ Assert.IsNotNull(deltaPage);
+
+ }
+
+ }
+}
diff --git a/DropNet.Tests/Helpers/RequestHelperTest.cs b/DropNet.Tests/Helpers/RequestHelperTest.cs
index f7326ef..90ed653 100644
--- a/DropNet.Tests/Helpers/RequestHelperTest.cs
+++ b/DropNet.Tests/Helpers/RequestHelperTest.cs
@@ -1,265 +1,264 @@
-using DropNet.Helpers;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using RestSharp;
-using Ploeh.AutoFixture;
-
-namespace DropNet.Tests
-{
-
-
- ///
- ///This is a test class for RequestHelperTest and is intended
- ///to contain all RequestHelperTest Unit Tests
- ///
- [TestClass()]
- public class RequestHelperTest
- {
- private RequestHelper _target;
- private string _version;
- private Fixture fixture;
-
- public RequestHelperTest()
- {
- _version = "0";
- _target = new RequestHelper(_version);
- fixture = new Fixture();
- }
-
- private TestContext testContextInstance;
-
- ///
- ///Gets or sets the test context which provides
- ///information about and functionality for the current test run.
- ///
- public TestContext TestContext
- {
- get
- {
- return testContextInstance;
- }
- set
- {
- testContextInstance = value;
- }
- }
-
- #region Additional test attributes
- //
- //You can use the following additional attributes as you write your tests:
- //
- //Use ClassInitialize to run code before running the first test in the class
- //[ClassInitialize()]
- //public static void MyClassInitialize(TestContext testContext)
- //{
- //}
- //
- //Use ClassCleanup to run code after all tests in a class have run
- //[ClassCleanup()]
- //public static void MyClassCleanup()
- //{
- //}
- //
- //Use TestInitialize to run code before running each test
- //[TestInitialize()]
- //public void MyTestInitialize()
- //{
- //}
- //
- //Use TestCleanup to run code after each test has run
- //[TestCleanup()]
- //public void MyTestCleanup()
- //{
- //}
- //
- #endregion
-
-
- ///
- ///A test for RequestHelper Constructor
- ///
- [TestMethod()]
- public void RequestHelperConstructorTest()
- {
- string version = "0";
- RequestHelper _target = new RequestHelper(version);
- Assert.IsNotNull(_target);
- }
-
- ///
- ///A test for CreateAccountInfoRequest
- ///
- [TestMethod()]
- public void CreateAccountInfoRequestTest()
- {
- RestRequest actual = _target.CreateAccountInfoRequest();
-
- Assert.IsNotNull(actual);
- Assert.IsTrue(actual.Method == Method.GET);
- Assert.IsNotNull(actual.Resource);
- Assert.IsNotNull(actual.Parameters);
- Assert.IsTrue(actual.Parameters.Count == 1);
- Assert.IsTrue(actual.Parameters[0].Name == "version");
- Assert.IsTrue(String.Equals(actual.Parameters[0].Value, _version));
- Assert.IsTrue(actual.Parameters[0].Type == ParameterType.UrlSegment);
- }
-
- ///
- ///A test for CreateCopyFileRequest
- ///
- [TestMethod()]
- public void CreateCopyFileRequestTest()
- {
- string fromPath = fixture.CreateAnonymous();
- string toPath = fixture.CreateAnonymous();
- RestRequest actual = _target.CreateCopyFileRequest(fromPath, toPath);
-
- Assert.IsNotNull(actual);
- Assert.IsTrue(actual.Method == Method.GET);
- Assert.IsNotNull(actual.Resource);
- Assert.IsNotNull(actual.Parameters);
- Assert.IsTrue(actual.Parameters.Count == 4);
- Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "version"));
- Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "from_path"));
- Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "to_path"));
- Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "root"));
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
- Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "from_path").Value, fromPath));
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "to_path").Value, toPath));
- }
-
- ///
- ///A test for CreateDeleteFileRequest
- ///
- [TestMethod()]
- public void CreateDeleteFileRequestTest()
- {
- string path = fixture.CreateAnonymous();
- RestRequest actual = _target.CreateDeleteFileRequest(path);
-
- Assert.IsNotNull(actual);
- Assert.IsTrue(actual.Method == Method.GET);
- Assert.IsNotNull(actual.Resource);
- Assert.IsNotNull(actual.Parameters);
- Assert.IsTrue(actual.Parameters.Count == 3);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
- Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "path").Value, path));
- }
-
- ///
- ///A test for CreateGetFileRequest
- ///
- [TestMethod()]
- public void CreateGetFileRequestTest()
- {
- string path = fixture.CreateAnonymous();
- RestRequest actual = _target.CreateGetFileRequest(path);
-
- Assert.IsNotNull(actual);
- Assert.IsTrue(actual.Method == Method.GET);
- Assert.IsNotNull(actual.Resource);
- Assert.IsNotNull(actual.Parameters);
- Assert.IsTrue(actual.Parameters.Count == 2);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
- Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "path").Value, path));
- Assert.IsTrue(actual.Parameters.Find(x => x.Name == "path").Type == ParameterType.UrlSegment);
- }
-
- ///
- ///A test for CreateLoginRequest
- ///
- [TestMethod()]
- public void CreateLoginRequestTest()
- {
- string apiKey = fixture.CreateAnonymous();
- string email = fixture.CreateAnonymous();
- string password = fixture.CreateAnonymous();
- RestRequest actual = _target.CreateLoginRequest(apiKey, email, password);
-
- Assert.IsNotNull(actual);
- Assert.IsTrue(actual.Method == Method.GET);
- Assert.IsNotNull(actual.Resource);
- Assert.IsNotNull(actual.Parameters);
- Assert.IsTrue(actual.Parameters.Count == 4);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
- Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "oauth_consumer_key").Value, apiKey));
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "email").Value, email));
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "password").Value, password));
- }
-
- ///
- ///A test for CreateMetadataRequest
- ///
- [TestMethod()]
- public void CreateMetadataRequestTest()
- {
- string path = fixture.CreateAnonymous();
- RestRequest actual = _target.CreateMetadataRequest(path);
-
- Assert.IsNotNull(actual);
- Assert.IsTrue(actual.Method == Method.GET);
- Assert.IsNotNull(actual.Resource);
- Assert.IsNotNull(actual.Parameters);
- Assert.IsTrue(actual.Parameters.Count == 2);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
- Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "path").Value, path));
- Assert.IsTrue(actual.Parameters.Find(x => x.Name == "path").Type == ParameterType.UrlSegment);
- }
-
- ///
- ///A test for CreateMoveFileRequest
- ///
- [TestMethod()]
- public void CreateMoveFileRequestTest()
- {
- string fromPath = fixture.CreateAnonymous();
- string toPath = fixture.CreateAnonymous();
- RestRequest actual = _target.CreateMoveFileRequest(fromPath, toPath);
-
- Assert.IsNotNull(actual);
- Assert.IsTrue(actual.Method == Method.GET);
- Assert.IsNotNull(actual.Resource);
- Assert.IsNotNull(actual.Parameters);
- Assert.IsTrue(actual.Parameters.Count == 4);
- Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "version"));
- Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "from_path"));
- Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "to_path"));
- Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "root"));
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
- Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "from_path").Value, fromPath));
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "to_path").Value, toPath));
- }
-
- ///
- ///A test for CreateUploadFileRequest
- ///
- [TestMethod()]
- public void CreateUploadFileRequestTest()
- {
- string path = fixture.CreateAnonymous();
- string filename = fixture.CreateAnonymous();
- byte[] fileData = System.Text.Encoding.UTF8.GetBytes(fixture.CreateAnonymous());
-
- RestRequest actual = _target.CreateUploadFileRequest(path, filename, fileData);
-
- Assert.IsNotNull(actual);
- Assert.IsTrue(actual.Method == Method.POST);
- Assert.IsNotNull(actual.Resource);
- Assert.IsNotNull(actual.Parameters);
- Assert.IsTrue(actual.Parameters.Count == 3);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
- Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "path").Value, path));
- Assert.IsTrue(actual.Parameters.Find(x => x.Name == "path").Type == ParameterType.UrlSegment);
- Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "file").Value, filename));
- Assert.IsTrue(actual.Files.Count == 1);
- Assert.IsTrue(actual.Files.Find(x => x.FileName == filename).Data.ToString() == fileData.ToString());
- }
- }
-}
+using DropNet.Helpers;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using RestSharp;
+using Ploeh.AutoFixture;
+
+namespace DropNet.Tests
+{
+
+
+ ///
+ ///This is a test class for RequestHelperTest and is intended
+ ///to contain all RequestHelperTest Unit Tests
+ ///
+ [TestClass()]
+ public class RequestHelperTest
+ {
+ private RequestHelper _target;
+ private string _version;
+ private Fixture fixture;
+
+ public RequestHelperTest()
+ {
+ _version = "0";
+ _target = new RequestHelper(_version);
+ fixture = new Fixture();
+ }
+
+ private TestContext testContextInstance;
+
+ ///
+ ///Gets or sets the test context which provides
+ ///information about and functionality for the current test run.
+ ///
+ public TestContext TestContext
+ {
+ get
+ {
+ return testContextInstance;
+ }
+ set
+ {
+ testContextInstance = value;
+ }
+ }
+
+ #region Additional test attributes
+ //
+ //You can use the following additional attributes as you write your tests:
+ //
+ //Use ClassInitialize to run code before running the first test in the class
+ //[ClassInitialize()]
+ //public static void MyClassInitialize(TestContext testContext)
+ //{
+ //}
+ //
+ //Use ClassCleanup to run code after all tests in a class have run
+ //[ClassCleanup()]
+ //public static void MyClassCleanup()
+ //{
+ //}
+ //
+ //Use TestInitialize to run code before running each test
+ //[TestInitialize()]
+ //public void MyTestInitialize()
+ //{
+ //}
+ //
+ //Use TestCleanup to run code after each test has run
+ //[TestCleanup()]
+ //public void MyTestCleanup()
+ //{
+ //}
+ //
+ #endregion
+
+
+ ///
+ ///A test for RequestHelper Constructor
+ ///
+ [TestMethod()]
+ public void RequestHelperConstructorTest()
+ {
+ string version = "0";
+ RequestHelper _target = new RequestHelper(version);
+ Assert.IsNotNull(_target);
+ }
+
+ ///
+ ///A test for CreateAccountInfoRequest
+ ///
+ [TestMethod()]
+ public void CreateAccountInfoRequestTest()
+ {
+ RestRequest actual = _target.CreateAccountInfoRequest();
+
+ Assert.IsNotNull(actual);
+ Assert.IsTrue(actual.Method == Method.GET);
+ Assert.IsNotNull(actual.Resource);
+ Assert.IsNotNull(actual.Parameters);
+ Assert.IsTrue(actual.Parameters.Count == 1);
+ Assert.IsTrue(actual.Parameters[0].Name == "version");
+ Assert.IsTrue(String.Equals(actual.Parameters[0].Value, _version));
+ Assert.IsTrue(actual.Parameters[0].Type == ParameterType.UrlSegment);
+ }
+
+ ///
+ ///A test for CreateCopyFileRequest
+ ///
+ [TestMethod()]
+ public void CreateCopyFileRequestTest()
+ {
+ string fromPath = fixture.CreateAnonymous();
+ string toPath = fixture.CreateAnonymous();
+ RestRequest actual = _target.CreateCopyFileRequest(fromPath, toPath, "dropbox");
+
+ Assert.IsNotNull(actual);
+ Assert.IsTrue(actual.Method == Method.GET);
+ Assert.IsNotNull(actual.Resource);
+ Assert.IsNotNull(actual.Parameters);
+ Assert.IsTrue(actual.Parameters.Count == 4);
+ Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "version"));
+ Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "from_path"));
+ Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "to_path"));
+ Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "root"));
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
+ Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "from_path").Value, fromPath));
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "to_path").Value, toPath));
+ }
+
+ ///
+ ///A test for CreateDeleteFileRequest
+ ///
+ [TestMethod()]
+ public void CreateDeleteFileRequestTest()
+ {
+ string path = fixture.CreateAnonymous();
+ RestRequest actual = _target.CreateDeleteFileRequest(path, "dropbox");
+
+ Assert.IsNotNull(actual);
+ Assert.IsTrue(actual.Method == Method.GET);
+ Assert.IsNotNull(actual.Resource);
+ Assert.IsNotNull(actual.Parameters);
+ Assert.IsTrue(actual.Parameters.Count == 3);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
+ Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "path").Value, path));
+ }
+
+ ///
+ ///A test for CreateGetFileRequest
+ ///
+ [TestMethod()]
+ public void CreateGetFileRequestTest()
+ {
+ string path = fixture.CreateAnonymous();
+ RestRequest actual = _target.CreateGetFileRequest(path, "dropbox");
+
+ Assert.IsNotNull(actual);
+ Assert.IsTrue(actual.Method == Method.GET);
+ Assert.IsNotNull(actual.Resource);
+ Assert.IsNotNull(actual.Parameters);
+ Assert.IsTrue(actual.Parameters.Count == 3);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
+ Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "path").Value, path));
+ Assert.IsTrue(actual.Parameters.Find(x => x.Name == "path").Type == ParameterType.UrlSegment);
+ }
+
+ ///
+ ///A test for CreateLoginRequest
+ ///
+ [TestMethod()]
+ public void CreateLoginRequestTest()
+ {
+ string apiKey = fixture.CreateAnonymous();
+ string email = fixture.CreateAnonymous();
+ string password = fixture.CreateAnonymous();
+ RestRequest actual = _target.CreateLoginRequest(apiKey, email, password);
+
+ Assert.IsNotNull(actual);
+ Assert.IsTrue(actual.Method == Method.GET);
+ Assert.IsNotNull(actual.Resource);
+ Assert.IsNotNull(actual.Parameters);
+ Assert.IsTrue(actual.Parameters.Count == 4);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
+ Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "oauth_consumer_key").Value, apiKey));
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "email").Value, email));
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "password").Value, password));
+ }
+
+ ///
+ ///A test for CreateMetadataRequest
+ ///
+ [TestMethod()]
+ public void CreateMetadataRequestTest()
+ {
+ string path = fixture.CreateAnonymous();
+ RestRequest actual = _target.CreateMetadataRequest(path, "dropbox", null, false, false);
+
+ Assert.IsNotNull(actual);
+ Assert.IsTrue(actual.Method == Method.GET);
+ Assert.IsNotNull(actual.Resource);
+ Assert.IsNotNull(actual.Parameters);
+ Assert.IsTrue(actual.Parameters.Count == 2);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
+ Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "path").Value, path));
+ Assert.IsTrue(actual.Parameters.Find(x => x.Name == "path").Type == ParameterType.UrlSegment);
+ }
+
+ ///
+ ///A test for CreateMoveFileRequest
+ ///
+ [TestMethod()]
+ public void CreateMoveFileRequestTest()
+ {
+ string fromPath = fixture.CreateAnonymous();
+ string toPath = fixture.CreateAnonymous();
+ RestRequest actual = _target.CreateMoveFileRequest(fromPath, toPath, "dropbox");
+
+ Assert.IsNotNull(actual);
+ Assert.IsTrue(actual.Method == Method.GET);
+ Assert.IsNotNull(actual.Resource);
+ Assert.IsNotNull(actual.Parameters);
+ Assert.IsTrue(actual.Parameters.Count == 4);
+ Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "version"));
+ Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "from_path"));
+ Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "to_path"));
+ Assert.IsTrue(actual.Parameters.Exists(x => x.Name == "root"));
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
+ Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "from_path").Value, fromPath));
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "to_path").Value, toPath));
+ }
+
+ ///
+ ///A test for CreateUploadFileRequest
+ ///
+ [TestMethod()]
+ public void CreateUploadFileRequestTest()
+ {
+ string path = fixture.CreateAnonymous();
+ string filename = fixture.CreateAnonymous();
+ byte[] fileData = System.Text.Encoding.UTF8.GetBytes(fixture.CreateAnonymous());
+
+ RestRequest actual = _target.CreateUploadFileRequest(path, filename, fileData, "dropbox", true, null);
+
+ Assert.IsNotNull(actual);
+ Assert.IsTrue(actual.Method == Method.POST);
+ Assert.IsNotNull(actual.Resource);
+ Assert.IsNotNull(actual.Parameters);
+ Assert.IsTrue(actual.Parameters.Count == 4);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "version").Value, _version));
+ Assert.IsTrue(actual.Parameters.Find(x => x.Name == "version").Type == ParameterType.UrlSegment);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "path").Value, path));
+ Assert.IsTrue(actual.Parameters.Find(x => x.Name == "path").Type == ParameterType.UrlSegment);
+ Assert.IsTrue(String.Equals(actual.Parameters.Find(x => x.Name == "file").Value, filename));
+ Assert.IsTrue(actual.Files.Count == 1);
+ }
+ }
+}
diff --git a/DropNet.Tests/TestVariables.cs b/DropNet.Tests/TestVariables.cs
index f5155b1..da201a9 100644
--- a/DropNet.Tests/TestVariables.cs
+++ b/DropNet.Tests/TestVariables.cs
@@ -4,9 +4,19 @@ namespace DropNet.Tests
public static class TestVariables
{
//Insert yo stuff here to run the tests
- public static string ApiKey = "ApiKey";
- public static string ApiSecret = "ApiSecret";
- public static string Email = "Email";
- public static string Password = "Password";
+ public static string ApiKey = "APIKEY";
+ public static string ApiSecret = "APISECRET";
+
+ public static string ApiKey_Sandbox = "SANDBOXKEY";
+ public static string ApiSecret_Sandbox = "SANDBOXSECRET";
+
+ public static string Email = "EMAIL";
+ public static string Password = "PASSWORD";
+
+ public static string Token = "TOKEN";
+ public static string Secret = "SECRET";
+
+ public static string Token_Sandbox = "SANDBOXTOKEN";
+ public static string Secret_Sandbox = "SANDBOXSECRET";
}
}
diff --git a/DropNet.Tests/UserTests.cs b/DropNet.Tests/UserTests.cs
deleted file mode 100644
index e40c6bb..0000000
--- a/DropNet.Tests/UserTests.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace DropNet.Tests
-{
- ///
- /// Summary description for UnitTest1
- ///
- [TestClass]
- public class UserTests
- {
- DropNetClient _client;
-
- public UserTests()
- {
- //
- // TODO: Add constructor logic here
- //
- _client = new DropNetClient(TestVariables.ApiKey, TestVariables.ApiSecret);
- }
-
- private TestContext testContextInstance;
-
- ///
- ///Gets or sets the test context which provides
- ///information about and functionality for the current test run.
- ///
- public TestContext TestContext
- {
- get
- {
- return testContextInstance;
- }
- set
- {
- testContextInstance = value;
- }
- }
-
- #region Additional test attributes
- //
- // You can use the following additional attributes as you write your tests:
- //
- // Use ClassInitialize to run code before running the first test in the class
- // [ClassInitialize()]
- // public static void MyClassInitialize(TestContext testContext) { }
- //
- // Use ClassCleanup to run code after all tests in a class have run
- // [ClassCleanup()]
- // public static void MyClassCleanup() { }
- //
- // Use TestInitialize to run code before running each test
- // [TestInitialize()]
- // public void MyTestInitialize() { }
- //
- // Use TestCleanup to run code after each test has run
- // [TestCleanup()]
- // public void MyTestCleanup() { }
- //
- #endregion
-
- [TestMethod]
- public void Can_Login()
- {
- //
- // TODO: Add test logic here
- //
- var userLogin = _client.Login(TestVariables.Email, TestVariables.Password);
-
- Assert.IsNotNull(userLogin);
- Assert.IsNotNull(userLogin.Token);
- Assert.IsNotNull(userLogin.Secret);
- }
-
- [TestMethod]
- public void Can_Get_AccountInfo()
- {
- //
- // TODO: Add test logic here
- //
- _client.Login(TestVariables.Email, TestVariables.Password);
- var accountInfo = _client.Account_Info();
-
- Assert.IsNotNull(accountInfo);
- Assert.IsNotNull(accountInfo.display_name);
- Assert.IsNotNull(accountInfo.uid);
- }
-
- }
-}
diff --git a/DropNet.Tests/UserTests1.cs b/DropNet.Tests/UserTests1.cs
new file mode 100644
index 0000000..d0ae7b1
--- /dev/null
+++ b/DropNet.Tests/UserTests1.cs
@@ -0,0 +1,133 @@
+using System;
+using DropNet.Authenticators;
+using DropNet.Exceptions;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace DropNet.Tests
+{
+ [TestClass]
+ public class UserTests1
+ {
+ readonly DropNetClient _client;
+
+ public UserTests1()
+ {
+ _client = new DropNetClient(TestVariables.ApiKey, TestVariables.ApiSecret);
+ }
+
+ [TestMethod]
+ public void Test_CanGetRequestToken()
+ {
+ var response = _client.GetToken();
+
+ Assert.IsNotNull(response);
+ Assert.IsNotNull(response.Token);
+ Assert.IsNotNull(response.Secret);
+ }
+
+ [TestMethod]
+ public void Test_CanBuildAutorizeUrl()
+ {
+ var authorizeUrl = _client.BuildAuthorizeUrl(new Models.UserLogin
+ {
+ Secret = TestVariables.Secret,
+ Token = TestVariables.Token
+ });
+
+ Assert.IsNotNull(authorizeUrl);
+ }
+
+ [TestMethod]
+ public void Test_BuildAutorizeUrl_ThrowNullException()
+ {
+ try
+ {
+ _client.BuildAuthorizeUrl();
+
+ Assert.Fail();
+ }
+ catch (ArgumentNullException ane)
+ {
+ Assert.IsNotNull(ane);
+ }
+ catch (Exception)
+ {
+ Assert.Fail();
+ }
+ }
+
+ [TestMethod]
+ public void Can_Get_AccountInfo()
+ {
+ _client.UserLogin = new Models.UserLogin { Token = TestVariables.Token, Secret = TestVariables.Secret };
+
+ var accountInfo = _client.AccountInfo();
+
+ Assert.IsNotNull(accountInfo);
+ Assert.IsNotNull(accountInfo.display_name);
+ Assert.IsNotNull(accountInfo.uid);
+ }
+
+ [TestMethod]
+ public void BuildOAuth2AuthorizationUrl_RedirectUriIsRequired()
+ {
+ try
+ {
+ _client.BuildAuthorizeUrl(OAuth2AuthorizationFlow.Code, null);
+ Assert.Fail();
+ }
+ catch (ArgumentNullException ane)
+ {
+ Assert.IsNotNull(ane);
+ }
+ catch (Exception)
+ {
+ Assert.Fail();
+ }
+ }
+
+ [TestMethod]
+ public void BuildOAuth2AuthorizationUrl_CodeFlow_NoState()
+ {
+ TestOAuth2AuthorizationUrl(OAuth2AuthorizationFlow.Code, "code");
+ }
+
+ [TestMethod]
+ public void BuildOAuth2AuthorizationUrl_CodeFlow_WithState()
+ {
+ TestOAuth2AuthorizationUrl(OAuth2AuthorizationFlow.Code, "code", "foobar");
+ }
+
+ [TestMethod]
+ public void BuildOAuth2AuthorizationUrl_TokenFlow_NoState()
+ {
+ TestOAuth2AuthorizationUrl(OAuth2AuthorizationFlow.Token, "token");
+ }
+
+ [TestMethod]
+ public void BuildOAuth2AuthorizationUrl_TokenFlow_WithState()
+ {
+ TestOAuth2AuthorizationUrl(OAuth2AuthorizationFlow.Token, "token", "foobar");
+ }
+
+ private void TestOAuth2AuthorizationUrl(OAuth2AuthorizationFlow oAuth2AuthorizationFlow, string expectedResponseType, string state = null)
+ {
+ const string expectedFormat = "https://api.dropbox.com/1/oauth2/authorize?response_type={0}&client_id={1}&redirect_uri=http://example.com{2}";
+ var stateQuery = string.IsNullOrWhiteSpace(state) ? string.Empty : string.Format("&state={0}", state);
+ var expected = string.Format(expectedFormat, expectedResponseType, TestVariables.ApiKey, stateQuery);
+ var actual = _client.BuildAuthorizeUrl(oAuth2AuthorizationFlow, "http://example.com", state);
+ Assert.IsNotNull(actual);
+ Assert.AreEqual(expected, actual);
+ }
+
+ [TestMethod]
+ [ExpectedException(typeof(DropboxException))]
+ public void Timeout_Exception_Raised_On_Super_Short_Timeout()
+ {
+ var client = new DropNetClient("", "");
+ client.TimeoutMS = 100;
+
+ client.GetToken();
+ }
+ }
+}
diff --git a/DropNet.Tests/app.config b/DropNet.Tests/app.config
new file mode 100644
index 0000000..429e035
--- /dev/null
+++ b/DropNet.Tests/app.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DropNet.Tests/packages.config b/DropNet.Tests/packages.config
new file mode 100644
index 0000000..6b04fa8
--- /dev/null
+++ b/DropNet.Tests/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/DropNet.WindowsPhone/DropNet.WindowsPhone.csproj b/DropNet.WindowsPhone/DropNet.WindowsPhone.csproj
index 8840d16..db042ab 100644
--- a/DropNet.WindowsPhone/DropNet.WindowsPhone.csproj
+++ b/DropNet.WindowsPhone/DropNet.WindowsPhone.csproj
@@ -11,13 +11,36 @@
PropertiesDropNet.WindowsPhoneDropNet.WindowsPhone
- v4.0
- $(TargetFrameworkVersion)
- WindowsPhone
- Silverlight
+ v8.0
+
+
+
+
+ WindowsPhonefalsetruetrue
+
+
+
+
+ 4.0
+ 11.0
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ truetrue
@@ -40,61 +63,127 @@
prompt4
+
+
+ Bin\x86\Debug
+ true
+ full
+ false
+
+
+
+ Bin\x86\Release
+ pdbonly
+ true
+
+
+
+ Bin\ARM\Debug
+ true
+ full
+ false
+
+
+
+ Bin\ARM\Release
+ pdbonly
+ true
+
-
-
- ..\Lib\RestSharp.WindowsPhone.dll
+
+ False
+ ..\packages\RestSharp.105.0.1\lib\sl4-wp71\RestSharp.WindowsPhone.dll
-
-
-
-
-
-
- Client\Client.cs
-
-
- Authenticators\OAuthAuthenticator.cs
-
+
+ Authenticators\OAuth2Authenticator.cs
+
+
+ Client\Client.cs
+
+
+ Authenticators\OAuthAuthenticator.cs
+
Client\Files.Async.cs
+
+ Client\Files.Task.cs
+
+
+ Client\IDropNetClient.cs
+
Client\User.Async.cs
Exceptions\DropboxException.cs
+
+ Extensions\RestClientExtensions.cs
+
Models\AccountInfo.cs
+
+ Models\ChunkedUpload.cs
+
+
+ Models\ChunkedUploadProgress.cs
+
+
+ Models\CopyRefResponse.cs
+
+
+ Models\DeltaPage.cs
+
Models\MetaData.cs
+
+ Models\OAuth2AccessToken.cs
+
+
+ Models\ThumbnailSize.cs
+
Models\UserLogin.cs
+
+ Models\SharesResponse.cs
+
-
- Resource.Designer.cs
- True
- True
- ..\dropnet\Resource.resx
-
-
- Helpers\RequestHelper.cs
-
+
+ Helpers\RequestHelper.cs
+
+
+ Helpers\ChunkedUploadHelper.cs
+
+
+
+
+ Extensions\StringExtensions.cs
+
+
+
+
+
-
- ResXFileCodeGenerator
- Resource.Designer.cs
-
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
-
-
+
+
\ No newline at end of file
diff --git a/DropNet/Exceptions/DropboxException.cs b/DropNet/Exceptions/DropboxException.cs
index 3ba464a..859d4cd 100644
--- a/DropNet/Exceptions/DropboxException.cs
+++ b/DropNet/Exceptions/DropboxException.cs
@@ -1,14 +1,75 @@
using System;
+using System.Linq;
+using RestSharp;
+using System.Net;
namespace DropNet.Exceptions
{
public class DropboxException : Exception
{
- public DropboxException(string message)
+ public DropboxException()
+ {
+
+ }
+
+ public DropboxException(string message) : base(message)
+ {
+ }
+ }
+
+ public class DropboxRestException : DropboxException
+ {
+ ///
+ /// Returned status code from the request
+ ///
+ public HttpStatusCode StatusCode { get; set; }
+
+ ///
+ /// Expected status codes to have seen instead of the one recieved.
+ ///
+ public HttpStatusCode[] ExpectedCodes { get; private set; }
+
+ ///
+ /// The response of the error call (for Debugging use)
+ ///
+ public IRestResponse Response { get; private set; }
+
+ public DropboxRestException()
+ {
+ }
+
+ public DropboxRestException(string message)
: base(message)
{
- //Wrapper class for DropNet Exceptions
}
+ ///
+ /// Creates a DropboxRestException with the rest response which caused the exception, and the status codes which were expected.
+ ///
+ /// Rest Response which was not expected.
+ /// The expected status codes which were not found.
+ public DropboxRestException(IRestResponse r, params HttpStatusCode[] expectedCodes)
+ {
+ Response = r;
+ StatusCode = r.StatusCode;
+ ExpectedCodes = expectedCodes;
+ }
+
+ ///
+ /// Overridden message for Dropbox Exception.
+ ///
+ /// The exception message in the format of "Received Response [{0}] : Expected to see [{1}]. The HTTP response was [{2}].
+ ///
+ ///
+ public override string Message
+ {
+ get
+ {
+ return string.Format("Received Response [{0}] : Expected to see [{1}]. The HTTP response was [{2}].",
+ Response.StatusCode,
+ string.Join(", ", ExpectedCodes.Select(code => Enum.GetName(typeof(HttpStatusCode), code))),
+ Response.Content);
+ }
+ }
}
}
diff --git a/DropNet/Extensions/RestClientExtensions.cs b/DropNet/Extensions/RestClientExtensions.cs
new file mode 100644
index 0000000..a5bf617
--- /dev/null
+++ b/DropNet/Extensions/RestClientExtensions.cs
@@ -0,0 +1,114 @@
+/* Code below modified from a version taken from Laurent Kempé's blog
+ * http://www.laurentkempe.com/post/Extending-existing-NET-API-to-support-asynchronous-operations.aspx
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using RestSharp;
+using System.Threading;
+using System.Net;
+using DropNet.Exceptions;
+
+namespace DropNet.Extensions
+{
+ public static class RestClientExtensions
+ {
+ public static Task ExecuteTask(this IRestClient client,
+ IRestRequest request) where TResult : new()
+ {
+ var tcs = new TaskCompletionSource();
+
+ WaitCallback
+ asyncWork = _ =>
+ {
+ try
+ {
+#if WINDOWS_PHONE
+ //check for network connection
+ if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
+ {
+ tcs.SetException(new DropboxRestException
+ {
+ StatusCode = System.Net.HttpStatusCode.BadGateway
+ });
+ return;
+ }
+#endif
+ client.ExecuteAsync(request,
+ (response, asynchandle) =>
+ {
+ if (response.StatusCode != HttpStatusCode.OK)
+ {
+ tcs.SetException(new DropboxRestException(response, HttpStatusCode.OK));
+ }
+ else
+ {
+ tcs.SetResult(response.Data);
+ }
+ });
+ }
+ catch (Exception exc)
+ {
+ tcs.SetException(exc);
+ }
+ };
+
+ return ExecuteTask(asyncWork, tcs);
+ }
+
+
+ public static Task ExecuteTask(this IRestClient client,
+ IRestRequest request)
+ {
+ var tcs = new TaskCompletionSource();
+
+ WaitCallback
+ asyncWork = _ =>
+ {
+ try
+ {
+#if WINDOWS_PHONE
+ //check for network connection
+ if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
+ {
+ tcs.SetException(new DropboxRestException
+ {
+ StatusCode = System.Net.HttpStatusCode.BadGateway
+ });
+ return;
+ }
+#endif
+ client.ExecuteAsync(request,
+ (response, asynchandle) =>
+ {
+ if (response.StatusCode != HttpStatusCode.OK)
+ {
+ tcs.SetException(new DropboxRestException(response, HttpStatusCode.OK));
+ }
+ else
+ {
+ tcs.SetResult(response);
+ }
+ });
+ }
+ catch (Exception exc)
+ {
+ tcs.SetException(exc);
+ }
+ };
+
+ return ExecuteTask(asyncWork, tcs);
+ }
+
+ private static Task ExecuteTask(WaitCallback asyncWork,
+ TaskCompletionSource tcs)
+ {
+ ThreadPool.QueueUserWorkItem(asyncWork);
+
+ return tcs.Task;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DropNet/Extensions/StringExtensions.cs b/DropNet/Extensions/StringExtensions.cs
new file mode 100644
index 0000000..29f59d8
--- /dev/null
+++ b/DropNet/Extensions/StringExtensions.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Text;
+
+namespace DropNet.Extensions
+{
+ public static class StringExtensions
+ {
+ public static string UrlEncode(this string value)
+ {
+ value = Uri.EscapeDataString(value);
+
+ StringBuilder builder = new StringBuilder();
+ foreach (char ch in value)
+ {
+ if ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~%".IndexOf(ch) != -1)
+ {
+ builder.Append(ch);
+ }
+ else
+ {
+ builder.Append('%' + string.Format("{0:X2}", (int)ch));
+ }
+ }
+ return builder.ToString();
+ }
+ }
+}
diff --git a/DropNet/Helpers/ChunkedUploadHelper.cs b/DropNet/Helpers/ChunkedUploadHelper.cs
new file mode 100644
index 0000000..58b9d70
--- /dev/null
+++ b/DropNet/Helpers/ChunkedUploadHelper.cs
@@ -0,0 +1,113 @@
+using System;
+using DropNet.Exceptions;
+using DropNet.Models;
+
+namespace DropNet.Helpers
+{
+ public class ChunkedUploadHelper
+ {
+ private const long DefaultMaxRetries = 100;
+ private readonly DropNetClient _client;
+ private readonly Func _chunkNeeded;
+ private readonly string _path;
+ private readonly Action _success;
+ private readonly Action _failure;
+ private readonly Action _progress;
+ private readonly bool _overwrite;
+ private readonly string _parentRevision;
+ private readonly long? _fileSize;
+ private readonly long? _maxRetries;
+ private long _chunksCompleted;
+ private long _chunksFailed;
+ private ChunkedUpload _lastChunkUploaded;
+
+ public ChunkedUploadHelper(DropNetClient client, Func chunkNeeded, string path, Action success, Action failure, Action progress, bool overwrite, string parentRevision, long? fileSize, long? maxRetries)
+ {
+ if (client == null)
+ {
+ throw new ArgumentNullException("client");
+ }
+
+ if (chunkNeeded == null)
+ {
+ throw new ArgumentNullException("chunkNeeded");
+ }
+
+ if (success == null)
+ {
+ throw new ArgumentNullException("success");
+ }
+
+ if (failure == null)
+ {
+ throw new ArgumentNullException("failure");
+ }
+
+ _client = client;
+ _chunkNeeded = chunkNeeded;
+ _path = path;
+ _success = success;
+ _failure = failure;
+ _progress = progress;
+ _overwrite = overwrite;
+ _parentRevision = parentRevision;
+ _fileSize = fileSize;
+ _maxRetries = maxRetries;
+ }
+
+ public void Start()
+ {
+ var firstChunk = _chunkNeeded.Invoke(0);
+ var chunkLength = firstChunk.GetLength(0);
+ if (chunkLength <= 0)
+ {
+ _failure.Invoke(new DropboxException("Aborting chunked upload because chunkNeeded function returned no data on first call."));
+ }
+
+ UpdateProgress(0, null);
+ _client.StartChunkedUploadAsync(firstChunk, OnChunkSuccess, OnChunkedUploadFailure );
+ }
+
+ private void UpdateProgress(long offset, string uploadId)
+ {
+ if (_progress != null)
+ {
+ _progress.Invoke(new ChunkedUploadProgress(uploadId, _chunksCompleted, offset, _chunksFailed, _fileSize));
+ }
+ }
+
+ private void OnChunkSuccess(ChunkedUpload chunkedUpload)
+ {
+ _chunksCompleted++;
+ _lastChunkUploaded = chunkedUpload;
+ UpdateProgress(chunkedUpload.Offset, chunkedUpload.UploadId);
+ var offset = chunkedUpload.Offset;
+ var nextChunk = _fileSize.GetValueOrDefault(long.MaxValue) > offset
+ ? _chunkNeeded.Invoke(offset)
+ : new byte[0];
+
+ var chunkLength = nextChunk.GetLength(0);
+ if (chunkLength > 0)
+ {
+ _client.AppendChunkedUploadAsync(chunkedUpload, nextChunk, OnChunkSuccess, OnChunkedUploadFailure);
+ }
+ else
+ {
+ _client.CommitChunkedUploadAsync(chunkedUpload, _path, _success, _failure, _overwrite, _parentRevision);
+ }
+ }
+
+ private void OnChunkedUploadFailure(DropboxException dropboxException)
+ {
+ _chunksFailed++;
+ if (_lastChunkUploaded != null && _chunksFailed <= _maxRetries.GetValueOrDefault(DefaultMaxRetries))
+ {
+ OnChunkSuccess(_lastChunkUploaded);
+ }
+ else
+ {
+ _failure.Invoke(dropboxException);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/DropNet/Helpers/RequestHelper.cs b/DropNet/Helpers/RequestHelper.cs
index 839e1b7..17b03e2 100644
--- a/DropNet/Helpers/RequestHelper.cs
+++ b/DropNet/Helpers/RequestHelper.cs
@@ -1,68 +1,242 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using System.IO;
+using DropNet.Authenticators;
using RestSharp;
+using DropNet.Models;
namespace DropNet.Helpers
{
+ ///
+ /// Helper class for creating DropNet RestSharp Requests
+ ///
public class RequestHelper
- {
-
- private string _version;
+ {
+ private readonly string _version;
public RequestHelper(string version)
{
_version = version;
}
- public RestRequest CreateMetadataRequest(string path)
+ public RestRequest CreateMetadataRequest(String path, String root, String hash, Boolean list, Boolean include_deleted)
{
var request = new RestRequest(Method.GET);
- request.Resource = "{version}/metadata/dropbox{path}";
+ request.Resource = "{version}/metadata/{root}{path}";
request.AddParameter("version", _version, ParameterType.UrlSegment);
request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+
+ if (list)
+ {
+ request.AddParameter("hash", hash);
+ request.AddParameter("list", list.ToString().ToLower());
+ request.AddParameter("include_deleted", include_deleted.ToString().ToLower());
+ }
return request;
}
- public RestRequest CreateGetFileRequest(string path)
+ public RestRequest CreateVersionsRequest(string path, string root, int rev_limit)
+ {
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/revisions/{root}{path}";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+ request.AddParameter("rev_limit", rev_limit, ParameterType.UrlSegment);
+
+ return request;
+ }
+
+ public RestRequest CreateShareRequest(string path, string root, bool shortUrl)
{
var request = new RestRequest(Method.GET);
- request.Resource = "{version}/files/dropbox{path}";
+ request.Resource = "{version}/shares/{root}{path}";
request.AddParameter("version", _version, ParameterType.UrlSegment);
request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+ request.AddParameter("short_url", shortUrl);
return request;
}
-
- public RestRequest CreateUploadFileRequest(string path, string filename, byte[] fileData)
+
+ public RestRequest CreateMediaRequest(string path, string root)
{
- var request = new RestRequest(Method.POST);
- request.Resource = "{version}/files/dropbox{path}";
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/media/{root}{path}";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+
+ return request;
+ }
+
+ public RestRequest CreateCopyRefRequest(string path, string root)
+ {
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/copy_ref/{root}{path}";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+
+ return request;
+ }
+
+ public RestRequest CreateGetFileRequest(string path, string root)
+ {
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/files/{root}{path}";
request.AddParameter("version", _version, ParameterType.UrlSegment);
request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+
+ return request;
+ }
+
+ public RestRequest CreateGetFileRequest(string path, string root, long startByte, long endByte, string rev)
+ {
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/files/{root}{path}";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+ request.AddParameter("rev", rev, ParameterType.UrlSegment);
+ request.AddHeader("Range", "bytes=" + startByte + "-" + endByte);
+
+ return request;
+ }
+
+ public RestRequest CreateUploadFileRequest(string path, string filename, byte[] fileData, string root, bool overwrite, string parent_revision)
+ {
+ var request = new RestRequest(Method.POST);
+ request.Resource = "{version}/files/{root}{path}";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+ //Need to add the "file" parameter with the file name
+ // This isn't needed. Dropbox is particular about the ordering,
+ // but the oauth sig only needs the filename, which we have in the OTHER parameter
+ //request.AddParameter("file", filename);
+
+ request.AddParameter("overwrite", overwrite);
+ if (!String.IsNullOrEmpty(parent_revision))
+ {
+ request.AddParameter("parent_rev", parent_revision);
+ }
+
+ request.AddFile("file", fileData, filename);
+
+ return request;
+ }
+
+ public RestRequest CreateUploadFilePutRequest(string path, string filename, byte[] fileData, string root, bool overwrite, string parent_revision)
+ {
+ var request = new RestRequest(Method.PUT);
+ //Need to put the OAuth Parmeters in the Resource to get around them being put in the body
+ request.Resource = "{version}/files_put/{root}{path}?file={file}&oauth_consumer_key={oauth_consumer_key}&oauth_nonce={oauth_nonce}";
+ request.Resource += "&oauth_token={oauth_token}&oauth_timestamp={oauth_timestamp}";
+ request.Resource += "&oauth_signature={oauth_signature}&oauth_signature_method={oauth_signature_method}&oauth_version={oauth_version}";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
//Need to add the "file" parameter with the file name
- request.AddParameter("file", filename);
+ request.AddParameter("file", filename, ParameterType.UrlSegment);
+
+ request.AddParameter("overwrite", overwrite);
+ if (!String.IsNullOrEmpty(parent_revision))
+ {
+ request.AddParameter("parent_rev", parent_revision);
+ }
- request.AddFile(fileData, filename, "file");
+ request.AddParameter("file", fileData, ParameterType.RequestBody);
+
+ return request;
+ }
+
+ public RestRequest CreateUploadFileRequest(string path, string filename, Stream fileStream, string root, bool overwrite, string parent_revision)
+ {
+ var request = new RestRequest(Method.POST);
+ //Don't want these to timeout (Maybe use something better here?)
+ request.Timeout = int.MaxValue;
+ request.Resource = "{version}/files/{root}{path}";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+ //Need to add the "file" parameter with the file name
+ // This isn't needed. Dropbox is particular about the ordering,
+ // but the oauth sig only needs the filename, which we have in the OTHER parameter
+ //request.AddParameter("file", filename);
+
+ request.AddParameter("overwrite", overwrite);
+ if (!String.IsNullOrEmpty(parent_revision))
+ {
+ request.AddParameter("parent_rev", parent_revision);
+ }
+
+ request.AddFile("file", s => StreamUtils.CopyStream(fileStream, s), filename);
+
+ return request;
+ }
+
+ public RestRequest CreateChunkedUploadRequest(byte[] fileData)
+ {
+ var request = new RestRequest(Method.PUT);
+ request.Resource = "{version}/chunked_upload?oauth_consumer_key={oauth_consumer_key}&oauth_nonce={oauth_nonce}";
+ request.Resource += "&oauth_token={oauth_token}&oauth_timestamp={oauth_timestamp}";
+ request.Resource += "&oauth_signature={oauth_signature}&oauth_signature_method={oauth_signature_method}&oauth_version={oauth_version}";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+
+ request.AddParameter("file", fileData, ParameterType.RequestBody);
return request;
}
-
- public RestRequest CreateDeleteFileRequest(string path)
+
+ public RestRequest CreateAppendChunkedUploadRequest(ChunkedUpload upload, byte[] fileData)
+ {
+ var request = new RestRequest(Method.PUT);
+ request.Resource = "{version}/chunked_upload?upload_id={upload_id}&offset={offset}&oauth_consumer_key={oauth_consumer_key}&oauth_nonce={oauth_nonce}";
+ request.Resource += "&oauth_token={oauth_token}&oauth_timestamp={oauth_timestamp}";
+ request.Resource += "&oauth_signature={oauth_signature}&oauth_signature_method={oauth_signature_method}&oauth_version={oauth_version}";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("upload_id", upload.UploadId, ParameterType.UrlSegment);
+ request.AddParameter("offset", upload.Offset, ParameterType.UrlSegment);
+
+ request.AddParameter("file", fileData, ParameterType.RequestBody);
+
+ return request;
+ }
+
+ public RestRequest CreateCommitChunkedUploadRequest(ChunkedUpload upload, string path, string root, bool overwrite, string parent_revision)
+ {
+ var request = new RestRequest(Method.POST);
+ request.Resource = "{version}/commit_chunked_upload/{root}{path}";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+
+ request.AddParameter("overwrite", overwrite);
+ request.AddParameter("upload_id", upload.UploadId);
+ if (!String.IsNullOrEmpty(parent_revision))
+ {
+ request.AddParameter("parent_rev", parent_revision);
+ }
+
+ return request;
+ }
+
+ public RestRequest CreateDeleteFileRequest(string path, string root)
{
var request = new RestRequest(Method.GET);
request.Resource = "{version}/fileops/delete";
request.AddParameter("version", _version, ParameterType.UrlSegment);
request.AddParameter("path", path);
- request.AddParameter("root", "dropbox");
+ request.AddParameter("root", root);
return request;
}
- public RestRequest CreateCopyFileRequest(string fromPath, string toPath)
+ public RestRequest CreateCopyFileRequest(string fromPath, string toPath, string root)
{
var request = new RestRequest(Method.GET);
request.Resource = "{version}/fileops/copy";
@@ -70,12 +244,25 @@ public RestRequest CreateCopyFileRequest(string fromPath, string toPath)
request.AddParameter("from_path", fromPath);
request.AddParameter("to_path", toPath);
- request.AddParameter("root", "dropbox");
+ request.AddParameter("root", root);
return request;
}
- public RestRequest CreateMoveFileRequest(string fromPath, string toPath)
+ public RestRequest CreateCopyFileFromCopyRefRequest(string fromCopyRef, string toPath, string root)
+ {
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/fileops/copy";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+
+ request.AddParameter("from_copy_ref", fromCopyRef);
+ request.AddParameter("to_path", toPath);
+ request.AddParameter("root", root);
+
+ return request;
+ }
+
+ public RestRequest CreateMoveFileRequest(string fromPath, string toPath, string root)
{
var request = new RestRequest(Method.GET);
request.Resource = "{version}/fileops/move";
@@ -83,7 +270,7 @@ public RestRequest CreateMoveFileRequest(string fromPath, string toPath)
request.AddParameter("from_path", fromPath);
request.AddParameter("to_path", toPath);
- request.AddParameter("root", "dropbox");
+ request.AddParameter("root", root);
return request;
}
@@ -103,6 +290,116 @@ public RestRequest CreateLoginRequest(string apiKey, string email, string passwo
return request;
}
+ public RestRequest CreateTokenRequest()
+ {
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/oauth/request_token";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+
+ return request;
+ }
+
+ public RestRequest CreateAccessTokenRequest()
+ {
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/oauth/access_token";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+
+ return request;
+ }
+
+ public RestRequest CreateAccessToken()
+ {
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/oauth/access_token";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ return request;
+ }
+
+ public RestRequest CreateNewAccountRequest(string apiKey, string email, string firstName, string lastName, string password)
+ {
+ var request = new RestRequest(Method.POST);
+ request.Resource = "{version}/account";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+
+ request.AddParameter("oauth_consumer_key", apiKey);
+
+ request.AddParameter("email", email);
+ request.AddParameter("first_name", firstName);
+ request.AddParameter("last_name", lastName);
+ request.AddParameter("password", password);
+
+ return request;
+ }
+
+ public RestRequest BuildAuthorizeUrl(string userToken, string callback = null)
+ {
+ if (string.IsNullOrWhiteSpace(userToken))
+ {
+ throw new ArgumentNullException("userToken");
+ }
+
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/oauth/authorize";
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("oauth_token", userToken);
+ if (!string.IsNullOrWhiteSpace(callback))
+ {
+ request.AddParameter("oauth_callback", callback);
+ }
+
+ return request;
+ }
+
+ ///
+ /// This is the first step the OAuth 2.0 authorization flow. This isn't an API call—it's the web page that lets the user sign in to Dropbox and authorize your app. The user must be redirected to the page over HTTPS and it should be presented to the user through their web browser. After the user decides whether or not to authorize your app, they will be redirected to the URL specified by redirect_uri.
+ ///
+ /// The type of authorization flow to use. See AuthorizationFlow documentation for descriptions of each.
+ ///
+ /// Where to redirect the user after authorization has completed. This must be the exact URI registered in the app console, though localhost and 127.0.0.1 are always accepted. A redirect URI is required for a token flow, but optional for code. If the redirect URI is omitted, the code will be presented directly to the user and they will be invited to enter the information in your app.
+ /// Arbitrary data that will be passed back to your redirect URI. This parameter can be used to track a user through the authorization flow.
+ /// A URL to which you should redirect the user. Because /oauth2/authorize is a website, there is no direct return value. However, after the user authorizes your app, they will be sent to your redirect URI. The type of response varies based on the response_type.
+ public RestRequest BuildOAuth2AuthorizeUrl(OAuth2AuthorizationFlow oAuth2AuthorizationFlow, string consumerKey, string redirectUri, string state = null)
+ {
+ var request = new RestRequest("{version}/oauth2/authorize", Method.GET);
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("response_type", Enum.GetName(typeof(OAuth2AuthorizationFlow), oAuth2AuthorizationFlow).ToLower());
+ request.AddParameter("client_id", consumerKey);
+ request.AddParameter("redirect_uri", redirectUri);
+ if (!string.IsNullOrWhiteSpace(state))
+ {
+ request.AddParameter("state", state);
+ }
+ return request;
+ }
+
+ ///
+ /// This is the second and final step in the OAuth 2.0 'code' authorization flow. It retrieves an OAuth2 access token using the code provided by Dropbox.
+ ///
+ /// The code provided by Dropbox when the user was redirected back to the calling site.
+ /// The calling site's host name, for verification only
+ ///
+ ///
+ ///
+ public RestRequest CreateOAuth2AccessTokenRequest(string code, string redirectUri, string consumerKey, string consumerSecret)
+ {
+ var request = new RestRequest("{version}/oauth2/token", Method.POST) { RequestFormat = DataFormat.Json };
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("code", code);
+ request.AddParameter("grant_type", "authorization_code");
+ request.AddParameter("client_id", consumerKey);
+ request.AddParameter("client_secret", consumerSecret);
+ request.AddParameter("redirect_uri", redirectUri);
+ return request;
+ }
+
+ public RestRequest CreateDisableAccessTokenRequest()
+ {
+ var request = new RestRequest("{version}/disable_access_token", Method.POST);
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ return request;
+ }
+
public RestRequest CreateAccountInfoRequest()
{
var request = new RestRequest(Method.GET);
@@ -112,17 +409,137 @@ public RestRequest CreateAccountInfoRequest()
return request;
}
- public RestRequest CreateCreateFolderRequest(string path)
+ public RestRequest CreateCreateFolderRequest(string path, string root)
{
var request = new RestRequest(Method.GET);
request.Resource = "{version}/fileops/create_folder";
request.AddParameter("version", _version, ParameterType.UrlSegment);
request.AddParameter("path", path);
- request.AddParameter("root", "dropbox");
+ request.AddParameter("root", root);
return request;
}
+ internal RestRequest CreateLongpollDeltaRequest(string cursor, int timeout)
+ {
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/longpoll_delta";
+
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("cursor", cursor);
+
+ if (timeout < 30)
+ timeout = 30;
+ if (timeout > 480)
+ timeout = 480;
+ request.AddParameter("timeout", timeout);
+
+ return request;
+ }
+
+ internal RestRequest CreateDeltaRequest(string cursor, string pathPrefix, string locale, bool includeMediaInfo)
+ {
+ var request = new RestRequest(Method.POST);
+ request.Resource = "{version}/delta";
+
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("cursor", cursor);
+ request.AddParameter("include_media_info", includeMediaInfo);
+
+ if (!string.IsNullOrEmpty(pathPrefix))
+ {
+ request.AddParameter("path_prefix", pathPrefix);
+ }
+
+ if (!string.IsNullOrEmpty(locale))
+ {
+ request.AddParameter("locale", locale);
+ }
+
+ return request;
+ }
+
+ public RestRequest CreateThumbnailRequest(string path, ThumbnailSize size, string root)
+ {
+ var request = new RestRequest(Method.GET);
+ request.Resource = "{version}/thumbnails/{root}{path}";
+
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+ request.AddParameter("size", ThumbnailSizeString(size));
+
+ return request;
+ }
+
+ private string ThumbnailSizeString(ThumbnailSize size)
+ {
+ switch (size)
+ {
+ case ThumbnailSize.Small:
+ return "small";
+ case ThumbnailSize.Medium:
+ return "medium";
+ case ThumbnailSize.Large:
+ return "large";
+ case ThumbnailSize.ExtraLarge:
+ return "l";
+ case ThumbnailSize.ExtraLarge2:
+ return "xl";
+ }
+ return "s";
+ }
+
+ public RestRequest CreateRestoreRequest(string rev, string path, string root)
+ {
+ var request = new RestRequest(Method.POST)
+ {
+ Resource = "{version}/restore/{root}{path}"
+ };
+
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+ request.AddParameter("rev", rev);
+
+ return request;
+ }
+
+ public RestRequest CreateSearchRequest(string searchString, string path, string root, int fileLimit)
+ {
+ var request = new RestRequest(Method.GET)
+ {
+ Resource = "{version}/search/{root}{path}"
+ };
+
+ request.AddParameter("version", _version, ParameterType.UrlSegment);
+ request.AddParameter("path", path, ParameterType.UrlSegment);
+ request.AddParameter("root", root, ParameterType.UrlSegment);
+ request.AddParameter("query", searchString);
+ request.AddParameter("file_limit", fileLimit);
+
+ return request;
+ }
}
+
+ internal static class StreamUtils
+ {
+ private const int STREAM_BUFFER_SIZE = 128 * 1024; // 128KB
+
+ public static void CopyStream (Stream source, Stream target)
+ { CopyStream (source, target, new byte[STREAM_BUFFER_SIZE]); }
+
+ public static void CopyStream (Stream source, Stream target, byte[] buffer)
+ {
+ if (source == null) throw new ArgumentNullException ("source");
+ if (target == null) throw new ArgumentNullException ("target");
+
+ if (buffer == null) buffer = new byte[STREAM_BUFFER_SIZE];
+ int bufferLength = buffer.Length;
+ int bytesRead;
+ while ((bytesRead = source.Read (buffer, 0, bufferLength)) > 0)
+ target.Write (buffer, 0, bytesRead);
+ }
+ }
}
diff --git a/DropNet/Models/AccountInfo.cs b/DropNet/Models/AccountInfo.cs
index f509a94..0333c93 100644
--- a/DropNet/Models/AccountInfo.cs
+++ b/DropNet/Models/AccountInfo.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace DropNet.Models
+namespace DropNet.Models
{
public class AccountInfo
{
@@ -13,6 +8,7 @@ public class AccountInfo
public string display_name { get; set; }
public QuotaInfo quota_info { get; set; }
public long uid { get; set; }
+ public Team team { get; set; }
}
public class QuotaInfo
@@ -21,4 +17,9 @@ public class QuotaInfo
public long quota { get; set; }
public long normal { get; set; }
}
+
+ public class Team
+ {
+ public string name { get; set; }
+ }
}
diff --git a/DropNet/Models/ChunkedUpload.cs b/DropNet/Models/ChunkedUpload.cs
new file mode 100644
index 0000000..eb0cecd
--- /dev/null
+++ b/DropNet/Models/ChunkedUpload.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+namespace DropNet.Models
+{
+ public class ChunkedUpload
+ {
+ public string UploadId { get; set; }
+ public long Offset { get; set; }
+ public string Expires { get; set; }
+ public DateTime ExpiresDate
+ {
+ get
+ {
+ return Expires == null ? DateTime.MinValue : DateTime.Parse(Expires);
+ }
+ }
+ }
+}
diff --git a/DropNet/Models/ChunkedUploadProgress.cs b/DropNet/Models/ChunkedUploadProgress.cs
new file mode 100644
index 0000000..5bd8ea9
--- /dev/null
+++ b/DropNet/Models/ChunkedUploadProgress.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+
+namespace DropNet.Models
+{
+ public class ChunkedUploadProgress
+ {
+ private readonly string _uploadId;
+ private readonly long _chunksCompleted;
+ private readonly long _bytesSaved;
+ private readonly long _retryCount;
+ private readonly long? _fileSize;
+
+ public ChunkedUploadProgress(string uploadId, long chunksCompleted, long bytesSaved, long retryCount, long? fileSize)
+ {
+ _uploadId = uploadId;
+ _chunksCompleted = chunksCompleted;
+ _bytesSaved = bytesSaved;
+ _retryCount = retryCount;
+ _fileSize = fileSize;
+ }
+
+ public string UploadId
+ {
+ get
+ {
+ return this._uploadId;
+ }
+ }
+
+ public long ChunksCompleted
+ {
+ get
+ {
+ return this._chunksCompleted;
+ }
+ }
+
+ public long BytesSaved
+ {
+ get
+ {
+ return this._bytesSaved;
+ }
+ }
+
+ public long? FileSize
+ {
+ get
+ {
+ return this._fileSize;
+ }
+ }
+
+ public long RetryCount
+ {
+ get
+ {
+ return this._retryCount;
+ }
+ }
+ }
+}
diff --git a/DropNet/Models/CopyRefResponse.cs b/DropNet/Models/CopyRefResponse.cs
new file mode 100644
index 0000000..bab5afc
--- /dev/null
+++ b/DropNet/Models/CopyRefResponse.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace DropNet.Models
+{
+ public class CopyRefResponse
+ {
+ public string Copy_Ref { get; set; }
+ public string Expires { get; set; }
+ public DateTime ExpiresDate
+ {
+ get { return DateTime.Parse(Expires); }
+ }
+ }
+}
diff --git a/DropNet/Models/DeltaPage.cs b/DropNet/Models/DeltaPage.cs
new file mode 100644
index 0000000..23bb66b
--- /dev/null
+++ b/DropNet/Models/DeltaPage.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace DropNet.Models
+{
+ ///
+ /// Response to the Delta API Call
+ ///
+ public class DeltaPage
+ {
+ ///
+ /// A string that encodes the latest information that has been returned. On the next call to GetDelta(), pass in this value.
+ ///
+ public string Cursor { get; set; }
+
+ ///
+ /// If true, then there are more entries available; you can call GetDelta() again immediately to retrieve those entries.
+ /// If 'false', then wait for at least five minutes (preferably longer) before checking again.
+ ///
+ public bool Has_More { get; set; }
+
+ ///
+ /// If true, clear your local state before processing the delta entries. reset is always true on the initial call to
+ /// GetDelta() (i.e. when no cursor is passed in). Otherwise, it is true in rare situations, such as after server or
+ /// account maintenance, or if a user deletes their app folder.
+ ///
+ public bool Reset { get; set; }
+
+ ///
+ /// A list of "delta entries" (described below).
+ ///
+ public List Entries { get; set; }
+ }
+
+ ///
+ /// Class representing a delta to a single file or folder
+ ///
+ public class DeltaEntry
+ {
+ ///
+ /// The path to a file or folder that has a delta. Dropbox treats file names in a case-insensitive but
+ /// case-preserving way. To facilitate this, the path values above are lower-cased versions of the actual path.
+ /// If present, the MetaData value has the original case-preserved path.
+ ///
+ public string Path { get; set; }
+
+ ///
+ /// If null: Indicates that there is no file/folder at the given path. To update your local state to match,
+ /// anything at path and all its children should be deleted. Deleting a folder in your Dropbox will sometimes
+ /// send down a single deleted entry for that folder, and sometimes separate entries for the folder and all child paths.
+ /// If your local state doesn't have anything at path, ignore this entry.
+ /// If not null:Indicates that there is a file/folder at the given path. You should add the entry to your local path.
+ /// The metadata value is the same as what would be returned by the /metadata call, except folder metadata doesn't have hash
+ /// or contents fields. To correctly process delta entries:
+ /// If the new entry includes parent folders that don't yet exist in your local state, create those parent folders in your local state.
+ /// If the new entry is a file, replace whatever your local state has at path with the new entry.
+ /// If the new entry is a folder, check what your local state has at Path. If it's a file, replace it with the new entry.
+ /// If it's a folder, apply the new MetaData to the folder, but do not modify the folder's children.
+ ///
+ public MetaData MetaData { get; set; }
+ }
+
+ public class LongpollDeltaResult
+ {
+ ///
+ /// The value of the changes field indicates whether new changes are available.
+ /// If this value is true, you should call /delta to retrieve the changes. If this value is false, it means the call to /longpoll_delta timed out.
+ ///
+ public bool Changes { get; set; }
+
+ ///
+ /// If present, the value of the backoff field indicates how many seconds your code should wait before calling /longpoll_delta again.
+ ///
+ public int Backoff { get; set; }
+ }
+}
diff --git a/DropNet/Models/MetaData.cs b/DropNet/Models/MetaData.cs
index c86105f..e97dcc7 100644
--- a/DropNet/Models/MetaData.cs
+++ b/DropNet/Models/MetaData.cs
@@ -1,50 +1,122 @@
-using System;
-using System.Collections.Generic;
-
-namespace DropNet.Models
-{
- public class MetaData
- {
- public string Hash { get; set; }
- public bool Thumb_Exists { get; set; }
- public long Bytes { get; set; }
- public DateTime Modified { get; set; }
- public string Path { get; set; }
- public bool Is_Dir { get; set; }
- public bool Is_Deleted { get; set; }
- public string Size { get; set; }
- public string Root { get; set; }
- public string Icon { get; set; }
- public List Contents { get; set; }
-
- public string Name
- {
- get
- {
- if (Path.LastIndexOf("/") == -1)
- {
- return string.Empty;
- }
- else
- {
- return string.IsNullOrEmpty(Path) ? "root" : Path.Substring(Path.LastIndexOf("/") + 1);
- }
- }
- }
- public string Extension
- {
- get
- {
- if (Path.LastIndexOf(".") == -1)
- {
- return string.Empty;
- }
- else
- {
- return Is_Dir ? string.Empty : Path.Substring(Path.LastIndexOf("."));
- }
- }
- }
- }
-
-}
+using System;
+using System.Collections.Generic;
+
+namespace DropNet.Models
+{
+ public class MetaData
+ {
+ public string Hash { get; set; }
+ public bool Thumb_Exists { get; set; }
+ public long Bytes { get; set; }
+ public string Modified { get; set; }
+ public string Client_Mtime { get; set; }
+ public string Path { get; set; }
+ public bool Is_Dir { get; set; }
+ public bool Is_Deleted { get; set; }
+ public string Size { get; set; }
+ public string Root { get; set; }
+ public string Icon { get; set; }
+ public int Revision { get; set; }
+ public string Rev { get; set; }
+ public List Contents { get; set; }
+ public String Mime_Type { get; set; }
+
+ public DateTime ModifiedDate
+ {
+ get
+ {
+ return GetDateTimeFromString(Modified);
+ }
+ }
+
+ public DateTime UTCDateModified
+ {
+ get
+ {
+ return GetUTCDateTimeFromString(Modified);
+ }
+ set
+ {
+ Modified = GetStringFromDateTime(value);
+ }
+ }
+
+ public DateTime Client_MtimeDate
+ {
+ get
+ {
+ return GetDateTimeFromString(Client_Mtime);
+ }
+ }
+
+ public DateTime UTCDateClient_Mtime
+ {
+ get
+ {
+ return GetUTCDateTimeFromString(Client_Mtime);
+ }
+ set
+ {
+ Client_Mtime = GetStringFromDateTime(value);
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(Path))
+ {
+ return string.Empty;
+ }
+
+ if (Path.LastIndexOf("/") == -1)
+ {
+ return string.Empty;
+ }
+
+ return string.IsNullOrEmpty(Path) ? "root" : Path.Substring(Path.LastIndexOf("/") + 1);
+ }
+ }
+
+ public string Extension
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(Path))
+ {
+ return string.Empty;
+ }
+
+ if (Path.LastIndexOf(".") == -1)
+ {
+ return string.Empty;
+ }
+
+ return Is_Dir ? string.Empty : Path.Substring(Path.LastIndexOf("."));
+ }
+ }
+
+ private static DateTime GetDateTimeFromString(string dateTimeStr)
+ {
+ //cast to datetime and return
+ return dateTimeStr == null ? DateTime.MinValue : DateTime.Parse(dateTimeStr); //RFC1123 format date codes are returned by API
+ }
+
+ private static DateTime GetUTCDateTimeFromString(string dateTimeStr)
+ {
+ string str = dateTimeStr;
+ if (str == null)
+ return DateTime.MinValue;
+ if (str.EndsWith(" +0000")) str = str.Substring(0, str.Length - 6);
+ if (!str.EndsWith(" UTC")) str += " UTC";
+ return DateTime.ParseExact(str, "ddd, d MMM yyyy HH:mm:ss UTC", System.Globalization.CultureInfo.InvariantCulture);
+ }
+
+ private static string GetStringFromDateTime(DateTime dateTime)
+ {
+ return dateTime.ToString("ddd, d MMM yyyy HH:mm:ss UTC");
+ }
+ }
+
+}
diff --git a/DropNet/Models/OAuth2AccessToken.cs b/DropNet/Models/OAuth2AccessToken.cs
new file mode 100644
index 0000000..ab4e66b
--- /dev/null
+++ b/DropNet/Models/OAuth2AccessToken.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace DropNet.Models
+{
+ ///
+ ///
+ internal class OAuth2AccessToken
+ {
+ ///
+ ///
+ public string Access_Token { get; set; }
+ public string Token_Type { get; set; }
+ public string Uid { get; set; }
+ }
+}
diff --git a/DropNet/Models/SharesResponse.cs b/DropNet/Models/SharesResponse.cs
new file mode 100644
index 0000000..0e4a26b
--- /dev/null
+++ b/DropNet/Models/SharesResponse.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace DropNet.Models
+{
+ public class ShareResponse
+ {
+ public string Url { get; set; }
+ public string Expires { get; set; }
+ public DateTime ExpiresDate
+ {
+ get { return DateTime.Parse(Expires); }
+ }
+ }
+}
diff --git a/DropNet/Models/ThumbnailSize.cs b/DropNet/Models/ThumbnailSize.cs
new file mode 100644
index 0000000..f3624a3
--- /dev/null
+++ b/DropNet/Models/ThumbnailSize.cs
@@ -0,0 +1,26 @@
+namespace DropNet.Models
+{
+ public enum ThumbnailSize
+ {
+ ///
+ /// 32px x 32px
+ ///
+ Small,
+ ///
+ /// 64px x 64px
+ ///
+ Medium,
+ ///
+ /// 128px x 128px
+ ///
+ Large,
+ ///
+ /// 640px x 480px
+ ///
+ ExtraLarge,
+ ///
+ /// 1024px x 768px
+ ///
+ ExtraLarge2 //dumb name
+ }
+}
diff --git a/DropNet/Models/UserLogin.cs b/DropNet/Models/UserLogin.cs
index c39582d..c7e6f39 100644
--- a/DropNet/Models/UserLogin.cs
+++ b/DropNet/Models/UserLogin.cs
@@ -1,10 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace DropNet.Models
-{
+using System;
+namespace DropNet.Models
+{
+#if !WINDOWS_PHONE
+ [Serializable]
+#endif
public class UserLogin
{
public string Token { get; set; }
diff --git a/DropNet/Properties/AssemblyInfo.cs b/DropNet/Properties/AssemblyInfo.cs
index 88bb5f8..d16cb77 100644
--- a/DropNet/Properties/AssemblyInfo.cs
+++ b/DropNet/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyVersion("1.8.2.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/DropNet/Resource.Designer.cs b/DropNet/Resource.Designer.cs
deleted file mode 100644
index c1110c8..0000000
--- a/DropNet/Resource.Designer.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace DropNet {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resource {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resource() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DropNet.Resource", typeof(Resource).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized string similar to http://api.dropbox.com.
- ///
- internal static string ApiBaseUrl {
- get {
- return ResourceManager.GetString("ApiBaseUrl", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to http://api-content.dropbox.com.
- ///
- internal static string ApiContentBaseUrl {
- get {
- return ResourceManager.GetString("ApiContentBaseUrl", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to https://api.getdropbox.com.
- ///
- internal static string SecureLoginBaseUrl {
- get {
- return ResourceManager.GetString("SecureLoginBaseUrl", resourceCulture);
- }
- }
- }
-}
diff --git a/DropNet/Resource.resources b/DropNet/Resource.resources
deleted file mode 100644
index 38b946c..0000000
Binary files a/DropNet/Resource.resources and /dev/null differ
diff --git a/DropNet/Resource.resx b/DropNet/Resource.resx
deleted file mode 100644
index a8f5667..0000000
--- a/DropNet/Resource.resx
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- http://api.dropbox.com
-
-
- http://api-content.dropbox.com
-
-
- https://api.getdropbox.com
-
-
\ No newline at end of file
diff --git a/DropNet/dropnet.nuspec b/DropNet/dropnet.nuspec
new file mode 100644
index 0000000..12ed2b7
--- /dev/null
+++ b/DropNet/dropnet.nuspec
@@ -0,0 +1,22 @@
+
+
+
+ DropNet
+ $version$
+ Damian Karzon, Github Contributors
+ Damian Karzon
+ .NET Client for the Dropbox API (.NET 4 and Windows Phone)
+ en-AU
+ http://dropnet.github.io/
+ https://github.com/dropnet/DropNet/blob/master/LICENSE.txt
+ http://dkdevelopment.net/img/DropNetIcon.png
+ DROPBOX API .NET WP8
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DropNet/packages.config b/DropNet/packages.config
new file mode 100644
index 0000000..46fa071
--- /dev/null
+++ b/DropNet/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..9aa0a58
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,67 @@
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/Lib/Moq.xml b/Lib/Moq.xml
deleted file mode 100644
index e0743a6..0000000
--- a/Lib/Moq.xml
+++ /dev/null
@@ -1,5120 +0,0 @@
-
-
-
- Moq
-
-
-
-
- Implements the fluent API.
-
-
-
-
- The expectation will be considered only in the former condition.
-
-
-
-
-
-
- The expectation will be considered only in the former condition.
-
-
-
-
-
-
-
- Setups the get.
-
- The type of the property.
- The expression.
-
-
-
-
- Setups the set.
-
- The type of the property.
- The setter expression.
-
-
-
-
- Setups the set.
-
- The setter expression.
-
-
-
-
- Defines the Callback verb and overloads.
-
-
-
-
- Helper interface used to hide the base
- members from the fluent API to make it much cleaner
- in Visual Studio intellisense.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Specifies a callback to invoke when the method is called.
-
- The callback method to invoke.
-
- The following example specifies a callback to set a boolean
- value that can be used later:
-
- var called = false;
- mock.Setup(x => x.Execute())
- .Callback(() => called = true);
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The argument type of the invoked method.
- The callback method to invoke.
-
- Invokes the given callback with the concrete invocation argument value.
-
- Notice how the specific string argument is retrieved by simply declaring
- it as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Callback((string command) => Console.WriteLine(command));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2) => Console.WriteLine(arg1 + arg2));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3) => Console.WriteLine(arg1 + arg2 + arg3));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16));
-
-
-
-
-
- Defines the Callback verb and overloads for callbacks on
- setups that return a value.
-
- Mocked type.
- Type of the return value of the setup.
-
-
-
- Specifies a callback to invoke when the method is called.
-
- The callback method to invoke.
-
- The following example specifies a callback to set a boolean value that can be used later:
-
- var called = false;
- mock.Setup(x => x.Execute())
- .Callback(() => called = true)
- .Returns(true);
-
- Note that in the case of value-returning methods, after the Callback
- call you can still specify the return value.
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original arguments.
-
- The type of the argument of the invoked method.
- Callback method to invoke.
-
- Invokes the given callback with the concrete invocation argument value.
-
- Notice how the specific string argument is retrieved by simply declaring
- it as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Callback(command => Console.WriteLine(command))
- .Returns(true);
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2) => Console.WriteLine(arg1 + arg2));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3) => Console.WriteLine(arg1 + arg2 + arg3));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4) => Console.WriteLine(arg1 + arg2 + arg3 + arg4));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15));
-
-
-
-
-
- Specifies a callback to invoke when the method is called that receives the original
- arguments.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The callback method to invoke.
- A reference to interface.
-
- Invokes the given callback with the concrete invocation arguments values.
-
- Notice how the specific arguments are retrieved by simply declaring
- them as part of the lambda expression for the callback:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>(),
- It.IsAny<string>()))
- .Callback((arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16) => Console.WriteLine(arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16));
-
-
-
-
-
- Defines the Raises verb.
-
-
-
-
- Specifies the event that will be raised
- when the setup is met.
-
- An expression that represents an event attach or detach action.
- The event arguments to pass for the raised event.
-
- The following example shows how to raise an event when
- the setup is met:
-
- var mock = new Mock<IContainer>();
-
- mock.Setup(add => add.Add(It.IsAny<string>(), It.IsAny<object>()))
- .Raises(add => add.Added += null, EventArgs.Empty);
-
-
-
-
-
- Specifies the event that will be raised
- when the setup is matched.
-
- An expression that represents an event attach or detach action.
- A function that will build the
- to pass when raising the event.
-
-
-
-
- Specifies the custom event that will be raised
- when the setup is matched.
-
- An expression that represents an event attach or detach action.
- The arguments to pass to the custom delegate (non EventHandler-compatible).
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
- The type of the fifteenth argument received by the expected invocation.
-
-
-
-
- Specifies the event that will be raised when the setup is matched.
-
- The expression that represents an event attach or detach action.
- The function that will build the
- to pass when raising the event.
- The type of the first argument received by the expected invocation.
- The type of the second argument received by the expected invocation.
- The type of the third argument received by the expected invocation.
- The type of the fourth argument received by the expected invocation.
- The type of the fifth argument received by the expected invocation.
- The type of the sixth argument received by the expected invocation.
- The type of the seventh argument received by the expected invocation.
- The type of the eighth argument received by the expected invocation.
- The type of the nineth argument received by the expected invocation.
- The type of the tenth argument received by the expected invocation.
- The type of the eleventh argument received by the expected invocation.
- The type of the twelfth argument received by the expected invocation.
- The type of the thirteenth argument received by the expected invocation.
- The type of the fourteenth argument received by the expected invocation.
- The type of the fifteenth argument received by the expected invocation.
- The type of the sixteenth argument received by the expected invocation.
-
-
-
-
- Defines the Returns verb.
-
- Mocked type.
- Type of the return value from the expression.
-
-
-
- Specifies the value to return.
-
- The value to return, or .
-
- Return a true value from the method call:
-
- mock.Setup(x => x.Execute("ping"))
- .Returns(true);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method.
-
- The function that will calculate the return value.
-
- Return a calculated value when the method is called:
-
- mock.Setup(x => x.Execute("ping"))
- .Returns(() => returnValues[0]);
-
- The lambda expression to retrieve the return value is lazy-executed,
- meaning that its value may change depending on the moment the method
- is executed and the value the returnValues array has at
- that moment.
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the argument of the invoked method.
- The function that will calculate the return value.
-
- Return a calculated value which is evaluated lazily at the time of the invocation.
-
- The lookup list can change between invocations and the setup
- will return different values accordingly. Also, notice how the specific
- string argument is retrieved by simply declaring it as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(It.IsAny<string>()))
- .Returns((string command) => returnValues[command]);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2) => arg1 + arg2);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3) => arg1 + arg2 + arg3);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4) => arg1 + arg2 + arg3 + arg4);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5) => arg1 + arg2 + arg3 + arg4 + arg5);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15);
-
-
-
-
-
- Specifies a function that will calculate the value to return from the method,
- retrieving the arguments for the invocation.
-
- The type of the first argument of the invoked method.
- The type of the second argument of the invoked method.
- The type of the third argument of the invoked method.
- The type of the fourth argument of the invoked method.
- The type of the fifth argument of the invoked method.
- The type of the sixth argument of the invoked method.
- The type of the seventh argument of the invoked method.
- The type of the eighth argument of the invoked method.
- The type of the nineth argument of the invoked method.
- The type of the tenth argument of the invoked method.
- The type of the eleventh argument of the invoked method.
- The type of the twelfth argument of the invoked method.
- The type of the thirteenth argument of the invoked method.
- The type of the fourteenth argument of the invoked method.
- The type of the fifteenth argument of the invoked method.
- The type of the sixteenth argument of the invoked method.
- The function that will calculate the return value.
- Returns a calculated value which is evaluated lazily at the time of the invocation.
-
-
- The return value is calculated from the value of the actual method invocation arguments.
- Notice how the arguments are retrieved by simply declaring them as part of the lambda
- expression:
-
-
- mock.Setup(x => x.Execute(
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>(),
- It.IsAny<int>()))
- .Returns((string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8, string arg9, string arg10, string arg11, string arg12, string arg13, string arg14, string arg15, string arg16) => arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10 + arg11 + arg12 + arg13 + arg14 + arg15 + arg16);
-
-
-
-
-
- Language for ReturnSequence
-
-
-
-
- Returns value
-
-
-
-
- Throws an exception
-
-
-
-
- Throws an exception
-
-
-
-
- The first method call or member access will be the
- last segment of the expression (depth-first traversal),
- which is the one we have to Setup rather than FluentMock.
- And the last one is the one we have to Mock.Get rather
- than FluentMock.
-
-
-
-
- Base class for mocks and static helper class with methods that
- apply to mocked objects, such as to
- retrieve a from an object instance.
-
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the specification of how the mocked object should behave.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Retrieves the mock object for the given object instance.
-
- Type of the mock to retrieve. Can be omitted as it's inferred
- from the object instance passed in as the instance.
- The instance of the mocked object.The mock associated with the mocked object.
- The received instance
- was not created by Moq.
-
- The following example shows how to add a new setup to an object
- instance which is not the original but rather
- the object associated with it:
-
- // Typed instance, not the mock, is retrieved from some test API.
- HttpContextBase context = GetMockContext();
-
- // context.Request is the typed object from the "real" API
- // so in order to add a setup to it, we need to get
- // the mock that "owns" it
- Mock<HttpRequestBase> request = Mock.Get(context.Request);
- mock.Setup(req => req.AppRelativeCurrentExecutionFilePath)
- .Returns(tempUrl);
-
-
-
-
-
- Returns the mocked object value.
-
-
-
-
- Verifies that all verifiable expectations have been met.
-
- This example sets up an expectation and marks it as verifiable. After
- the mock is used, a Verify() call is issued on the mock
- to ensure the method in the setup was invoked:
-
- var mock = new Mock<IWarehouse>();
- this.Setup(x => x.HasInventory(TALISKER, 50)).Verifiable().Returns(true);
- ...
- // other test code
- ...
- // Will throw if the test code has didn't call HasInventory.
- this.Verify();
-
- Not all verifiable expectations were met.
-
-
-
- Verifies all expectations regardless of whether they have
- been flagged as verifiable.
-
- This example sets up an expectation without marking it as verifiable. After
- the mock is used, a call is issued on the mock
- to ensure that all expectations are met:
-
- var mock = new Mock<IWarehouse>();
- this.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true);
- ...
- // other test code
- ...
- // Will throw if the test code has didn't call HasInventory, even
- // that expectation was not marked as verifiable.
- this.VerifyAll();
-
- At least one expectation was not met.
-
-
-
- Gets the interceptor target for the given expression and root mock,
- building the intermediate hierarchy of mock objects if necessary.
-
-
-
-
- Raises the associated event with the given
- event argument data.
-
-
-
-
- Raises the associated event with the given
- event argument data.
-
-
-
-
- Adds an interface implementation to the mock,
- allowing setups to be specified for it.
-
- This method can only be called before the first use
- of the mock property, at which
- point the runtime type has already been generated
- and no more interfaces can be added to it.
-
- Also, must be an
- interface and not a class, which must be specified
- when creating the mock instead.
-
-
- The mock type
- has already been generated by accessing the property.
-
- The specified
- is not an interface.
-
- The following example creates a mock for the main interface
- and later adds to it to verify
- it's called by the consumer code:
-
- var mock = new Mock<IProcessor>();
- mock.Setup(x => x.Execute("ping"));
-
- // add IDisposable interface
- var disposable = mock.As<IDisposable>();
- disposable.Setup(d => d.Dispose()).Verifiable();
-
- Type of interface to cast the mock to.
-
-
-
-
-
-
- Behavior of the mock, according to the value set in the constructor.
-
-
-
-
- Whether the base member virtual implementation will be called
- for mocked classes if no setup is matched. Defaults to .
-
-
-
-
- Specifies the behavior to use when returning default values for
- unexpected invocations on loose mocks.
-
-
-
-
- Gets the mocked object instance.
-
-
-
-
- Retrieves the type of the mocked object, its generic type argument.
- This is used in the auto-mocking of hierarchy access.
-
-
-
-
- Specifies the class that will determine the default
- value to return when invocations are made that
- have no setups and need to return a default
- value (for loose mocks).
-
-
-
-
- Exposes the list of extra interfaces implemented by the mock.
-
-
-
-
- Utility repository class to use to construct multiple
- mocks when consistent verification is
- desired for all of them.
-
-
- If multiple mocks will be created during a test, passing
- the desired (if different than the
- or the one
- passed to the repository constructor) and later verifying each
- mock can become repetitive and tedious.
-
- This repository class helps in that scenario by providing a
- simplified creation of multiple mocks with a default
- (unless overriden by calling
- ) and posterior verification.
-
-
-
- The following is a straightforward example on how to
- create and automatically verify strict mocks using a :
-
- var repository = new MockRepository(MockBehavior.Strict);
-
- var foo = repository.Create<IFoo>();
- var bar = repository.Create<IBar>();
-
- // no need to call Verifiable() on the setup
- // as we'll be validating all of them anyway.
- foo.Setup(f => f.Do());
- bar.Setup(b => b.Redo());
-
- // exercise the mocks here
-
- repository.VerifyAll();
- // At this point all setups are already checked
- // and an optional MockException might be thrown.
- // Note also that because the mocks are strict, any invocation
- // that doesn't have a matching setup will also throw a MockException.
-
- The following examples shows how to setup the repository
- to create loose mocks and later verify only verifiable setups:
-
- var repository = new MockRepository(MockBehavior.Loose);
-
- var foo = repository.Create<IFoo>();
- var bar = repository.Create<IBar>();
-
- // this setup will be verified when we verify the repository
- foo.Setup(f => f.Do()).Verifiable();
-
- // this setup will NOT be verified
- foo.Setup(f => f.Calculate());
-
- // this setup will be verified when we verify the repository
- bar.Setup(b => b.Redo()).Verifiable();
-
- // exercise the mocks here
- // note that because the mocks are Loose, members
- // called in the interfaces for which no matching
- // setups exist will NOT throw exceptions,
- // and will rather return default values.
-
- repository.Verify();
- // At this point verifiable setups are already checked
- // and an optional MockException might be thrown.
-
- The following examples shows how to setup the repository with a
- default strict behavior, overriding that default for a
- specific mock:
-
- var repository = new MockRepository(MockBehavior.Strict);
-
- // this particular one we want loose
- var foo = repository.Create<IFoo>(MockBehavior.Loose);
- var bar = repository.Create<IBar>();
-
- // specify setups
-
- // exercise the mocks here
-
- repository.Verify();
-
-
-
-
-
-
- Utility factory class to use to construct multiple
- mocks when consistent verification is
- desired for all of them.
-
-
- If multiple mocks will be created during a test, passing
- the desired (if different than the
- or the one
- passed to the factory constructor) and later verifying each
- mock can become repetitive and tedious.
-
- This factory class helps in that scenario by providing a
- simplified creation of multiple mocks with a default
- (unless overriden by calling
- ) and posterior verification.
-
-
-
- The following is a straightforward example on how to
- create and automatically verify strict mocks using a :
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>();
- var bar = factory.Create<IBar>();
-
- // no need to call Verifiable() on the setup
- // as we'll be validating all of them anyway.
- foo.Setup(f => f.Do());
- bar.Setup(b => b.Redo());
-
- // exercise the mocks here
-
- factory.VerifyAll();
- // At this point all setups are already checked
- // and an optional MockException might be thrown.
- // Note also that because the mocks are strict, any invocation
- // that doesn't have a matching setup will also throw a MockException.
-
- The following examples shows how to setup the factory
- to create loose mocks and later verify only verifiable setups:
-
- var factory = new MockFactory(MockBehavior.Loose);
-
- var foo = factory.Create<IFoo>();
- var bar = factory.Create<IBar>();
-
- // this setup will be verified when we verify the factory
- foo.Setup(f => f.Do()).Verifiable();
-
- // this setup will NOT be verified
- foo.Setup(f => f.Calculate());
-
- // this setup will be verified when we verify the factory
- bar.Setup(b => b.Redo()).Verifiable();
-
- // exercise the mocks here
- // note that because the mocks are Loose, members
- // called in the interfaces for which no matching
- // setups exist will NOT throw exceptions,
- // and will rather return default values.
-
- factory.Verify();
- // At this point verifiable setups are already checked
- // and an optional MockException might be thrown.
-
- The following examples shows how to setup the factory with a
- default strict behavior, overriding that default for a
- specific mock:
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- // this particular one we want loose
- var foo = factory.Create<IFoo>(MockBehavior.Loose);
- var bar = factory.Create<IBar>();
-
- // specify setups
-
- // exercise the mocks here
-
- factory.Verify();
-
-
-
-
-
-
- Initializes the factory with the given
- for newly created mocks from the factory.
-
- The behavior to use for mocks created
- using the factory method if not overriden
- by using the overload.
-
-
-
- Creates a new mock with the default
- specified at factory construction time.
-
- Type to mock.
- A new .
-
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>();
- // use mock on tests
-
- factory.VerifyAll();
-
-
-
-
-
- Creates a new mock with the default
- specified at factory construction time and with the
- the given constructor arguments for the class.
-
-
- The mock will try to find the best match constructor given the
- constructor arguments, and invoke that to initialize the instance.
- This applies only to classes, not interfaces.
-
- Type to mock.
- Constructor arguments for mocked classes.
- A new .
-
-
- var factory = new MockFactory(MockBehavior.Default);
-
- var mock = factory.Create<MyBase>("Foo", 25, true);
- // use mock on tests
-
- factory.Verify();
-
-
-
-
-
- Creates a new mock with the given .
-
- Type to mock.
- Behavior to use for the mock, which overrides
- the default behavior specified at factory construction time.
- A new .
-
- The following example shows how to create a mock with a different
- behavior to that specified as the default for the factory:
-
- var factory = new MockFactory(MockBehavior.Strict);
-
- var foo = factory.Create<IFoo>(MockBehavior.Loose);
-
-
-
-
-
- Creates a new mock with the given
- and with the the given constructor arguments for the class.
-
-
- The mock will try to find the best match constructor given the
- constructor arguments, and invoke that to initialize the instance.
- This applies only to classes, not interfaces.
-
- Type to mock.
- Behavior to use for the mock, which overrides
- the default behavior specified at factory construction time.
- Constructor arguments for mocked classes.
- A new .
-
- The following example shows how to create a mock with a different
- behavior to that specified as the default for the factory, passing
- constructor arguments:
-
- var factory = new MockFactory(MockBehavior.Default);
-
- var mock = factory.Create<MyBase>(MockBehavior.Strict, "Foo", 25, true);
-
-
-
-
-
- Implements creation of a new mock within the factory.
-
- Type to mock.
- The behavior for the new mock.
- Optional arguments for the construction of the mock.
-
-
-
- Verifies all verifiable expectations on all mocks created
- by this factory.
-
-
- One or more mocks had expectations that were not satisfied.
-
-
-
- Verifies all verifiable expectations on all mocks created
- by this factory.
-
-
- One or more mocks had expectations that were not satisfied.
-
-
-
- Invokes for each mock
- in , and accumulates the resulting
- that might be
- thrown from the action.
-
- The action to execute against
- each mock.
-
-
-
- Whether the base member virtual implementation will be called
- for mocked classes if no setup is matched. Defaults to .
-
-
-
-
- Specifies the behavior to use when returning default values for
- unexpected invocations on loose mocks.
-
-
-
-
- Gets the mocks that have been created by this factory and
- that will get verified together.
-
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The type of the mocked object to query.
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The predicate with the setup expressions.
- The type of the mocked object to query.
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the setup expressions.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates the mock query with the underlying queriable implementation.
-
-
-
-
- Wraps the enumerator inside a queryable.
-
-
-
-
- Method that is turned into the actual call from .Query{T}, to
- transform the queryable query into a normal enumerable query.
- This method is never used directly by consumers.
-
-
-
-
- Initializes the repository with the given
- for newly created mocks from the repository.
-
- The behavior to use for mocks created
- using the repository method if not overriden
- by using the overload.
-
-
-
- A that returns an empty default value
- for invocations that do not have setups or return values, with loose mocks.
- This is the default behavior for a mock.
-
-
-
-
- Interface to be implemented by classes that determine the
- default value of non-expected invocations.
-
-
-
-
- Defines the default value to return in all the methods returning .
- The type of the return value.The value to set as default.
-
-
-
- Provides a value for the given member and arguments.
-
- The member to provide a default value for.
-
-
-
-
- The intention of is to create a more readable
- string representation for the failure message.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Throws verb.
-
-
-
-
- Specifies the exception to throw when the method is invoked.
-
- Exception instance to throw.
-
- This example shows how to throw an exception when the method is
- invoked with an empty string argument:
-
- mock.Setup(x => x.Execute(""))
- .Throws(new ArgumentException());
-
-
-
-
-
- Specifies the type of exception to throw when the method is invoked.
-
- Type of exception to instantiate and throw when the setup is matched.
-
- This example shows how to throw an exception when the method is
- invoked with an empty string argument:
-
- mock.Setup(x => x.Execute(""))
- .Throws<ArgumentException>();
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines occurrence members to constraint setups.
-
-
-
-
- The expected invocation can happen at most once.
-
-
-
- var mock = new Mock<ICommand>();
- mock.Setup(foo => foo.Execute("ping"))
- .AtMostOnce();
-
-
-
-
-
- The expected invocation can happen at most specified number of times.
-
- The number of times to accept calls.
-
-
- var mock = new Mock<ICommand>();
- mock.Setup(foo => foo.Execute("ping"))
- .AtMost( 5 );
-
-
-
-
-
- Defines the Verifiable verb.
-
-
-
-
- Marks the expectation as verifiable, meaning that a call
- to will check if this particular
- expectation was met.
-
-
- The following example marks the expectation as verifiable:
-
- mock.Expect(x => x.Execute("ping"))
- .Returns(true)
- .Verifiable();
-
-
-
-
-
- Marks the expectation as verifiable, meaning that a call
- to will check if this particular
- expectation was met, and specifies a message for failures.
-
-
- The following example marks the expectation as verifiable:
-
- mock.Expect(x => x.Execute("ping"))
- .Returns(true)
- .Verifiable("Ping should be executed always!");
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- We need this non-generics base class so that
- we can use from
- generic code.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Callback verb for property getter setups.
-
-
- Mocked type.
- Type of the property.
-
-
-
- Specifies a callback to invoke when the property is retrieved.
-
- Callback method to invoke.
-
- Invokes the given callback with the property value being set.
-
- mock.SetupGet(x => x.Suspended)
- .Callback(() => called = true)
- .Returns(true);
-
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Returns verb for property get setups.
-
- Mocked type.
- Type of the property.
-
-
-
- Specifies the value to return.
-
- The value to return, or .
-
- Return a true value from the property getter call:
-
- mock.SetupGet(x => x.Suspended)
- .Returns(true);
-
-
-
-
-
- Specifies a function that will calculate the value to return for the property.
-
- The function that will calculate the return value.
-
- Return a calculated value when the property is retrieved:
-
- mock.SetupGet(x => x.Suspended)
- .Returns(() => returnValues[0]);
-
- The lambda expression to retrieve the return value is lazy-executed,
- meaning that its value may change depending on the moment the property
- is retrieved and the value the returnValues array has at
- that moment.
-
-
-
-
- Implements the fluent API.
-
-
-
-
- Helper class to setup a full trace between many mocks
-
-
-
-
- Initialize a trace setup
-
-
-
-
- Allow sequence to be repeated
-
-
-
-
- define nice api
-
-
-
-
- Perform an expectation in the trace.
-
-
-
-
- Marks a method as a matcher, which allows complete replacement
- of the built-in class with your own argument
- matching rules.
-
-
- This feature has been deprecated in favor of the new
- and simpler .
-
-
- The argument matching is used to determine whether a concrete
- invocation in the mock matches a given setup. This
- matching mechanism is fully extensible.
-
-
- There are two parts of a matcher: the compiler matcher
- and the runtime matcher.
-
-
- Compiler matcher
- Used to satisfy the compiler requirements for the
- argument. Needs to be a method optionally receiving any arguments
- you might need for the matching, but with a return type that
- matches that of the argument.
-
- Let's say I want to match a lists of orders that contains
- a particular one. I might create a compiler matcher like the following:
-
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return null;
- }
- }
-
- Now we can invoke this static method instead of an argument in an
- invocation:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
- Note that the return value from the compiler matcher is irrelevant.
- This method will never be called, and is just used to satisfy the
- compiler and to signal Moq that this is not a method that we want
- to be invoked at runtime.
-
-
-
- Runtime matcher
-
- The runtime matcher is the one that will actually perform evaluation
- when the test is run, and is defined by convention to have the
- same signature as the compiler matcher, but where the return
- value is the first argument to the call, which contains the
- object received by the actual invocation at runtime:
-
- public static bool Contains(IEnumerable<Order> orders, Order order)
- {
- return orders.Contains(order);
- }
-
- At runtime, the mocked method will be invoked with a specific
- list of orders. This value will be passed to this runtime
- matcher as the first argument, while the second argument is the
- one specified in the setup (x.Save(Orders.Contains(order))).
-
- The boolean returned determines whether the given argument has been
- matched. If all arguments to the expected method are matched, then
- the setup matches and is evaluated.
-
-
-
-
-
- Using this extensible infrastructure, you can easily replace the entire
- set of matchers with your own. You can also avoid the
- typical (and annoying) lengthy expressions that result when you have
- multiple arguments that use generics.
-
-
- The following is the complete example explained above:
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return null;
- }
-
- public static bool Contains(IEnumerable<Order> orders, Order order)
- {
- return orders.Contains(order);
- }
- }
-
- And the concrete test using this matcher:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
- // use mock, invoke Save, and have the matcher filter.
-
-
-
-
-
- Provides a mock implementation of .
-
- Any interface type can be used for mocking, but for classes, only abstract and virtual members can be mocked.
-
- The behavior of the mock with regards to the setups and the actual calls is determined
- by the optional that can be passed to the
- constructor.
-
- Type to mock, which can be an interface or a class.
- The following example shows establishing setups with specific values
- for method invocations:
-
- // Arrange
- var order = new Order(TALISKER, 50);
- var mock = new Mock<IWarehouse>();
-
- mock.Setup(x => x.HasInventory(TALISKER, 50)).Returns(true);
-
- // Act
- order.Fill(mock.Object);
-
- // Assert
- Assert.True(order.IsFilled);
-
- The following example shows how to use the class
- to specify conditions for arguments instead of specific values:
-
- // Arrange
- var order = new Order(TALISKER, 50);
- var mock = new Mock<IWarehouse>();
-
- // shows how to expect a value within a range
- mock.Setup(x => x.HasInventory(
- It.IsAny<string>(),
- It.IsInRange(0, 100, Range.Inclusive)))
- .Returns(false);
-
- // shows how to throw for unexpected calls.
- mock.Setup(x => x.Remove(
- It.IsAny<string>(),
- It.IsAny<int>()))
- .Throws(new InvalidOperationException());
-
- // Act
- order.Fill(mock.Object);
-
- // Assert
- Assert.False(order.IsFilled);
-
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Ctor invoked by AsTInterface exclusively.
-
-
-
-
- Initializes an instance of the mock with default behavior.
-
- var mock = new Mock<IFormatProvider>();
-
-
-
-
- Initializes an instance of the mock with default behavior and with
- the given constructor arguments for the class. (Only valid when is a class)
-
- The mock will try to find the best match constructor given the constructor arguments, and invoke that
- to initialize the instance. This applies only for classes, not interfaces.
-
- var mock = new Mock<MyProvider>(someArgument, 25);
- Optional constructor arguments if the mocked type is a class.
-
-
-
- Initializes an instance of the mock with the specified behavior.
-
- var mock = new Mock<IFormatProvider>(MockBehavior.Relaxed);
- Behavior of the mock.
-
-
-
- Initializes an instance of the mock with a specific behavior with
- the given constructor arguments for the class.
-
- The mock will try to find the best match constructor given the constructor arguments, and invoke that
- to initialize the instance. This applies only to classes, not interfaces.
-
- var mock = new Mock<MyProvider>(someArgument, 25);
- Behavior of the mock.Optional constructor arguments if the mocked type is a class.
-
-
-
- Returns the mocked object value.
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a void method.
-
- If more than one setup is specified for the same method or property,
- the latest one wins and is the one that will be executed.
- Lambda expression that specifies the expected method invocation.
-
- var mock = new Mock<IProcessor>();
- mock.Setup(x => x.Execute("ping"));
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a value returning method.
- Type of the return value. Typically omitted as it can be inferred from the expression.
- If more than one setup is specified for the same method or property,
- the latest one wins and is the one that will be executed.
- Lambda expression that specifies the method invocation.
-
- mock.Setup(x => x.HasInventory("Talisker", 50)).Returns(true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property getter.
-
- If more than one setup is set for the same property getter,
- the latest one wins and is the one that will be executed.
- Type of the property. Typically omitted as it can be inferred from the expression.Lambda expression that specifies the property getter.
-
- mock.SetupGet(x => x.Suspended)
- .Returns(true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter.
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
-
- This overloads allows the use of a callback already
- typed for the property type.
-
- Type of the property. Typically omitted as it can be inferred from the expression.The Lambda expression that sets a property to a value.
-
- mock.SetupSet(x => x.Suspended = true);
-
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter.
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
- Lambda expression that sets a property to a value.
-
- mock.SetupSet(x => x.Suspended = true);
-
-
-
-
-
- Specifies that the given property should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. (this is also
- known as "stubbing").
-
- Type of the property, inferred from the property
- expression (does not need to be specified).
- Property expression to stub.
- If you have an interface with an int property Value, you might
- stub it using the following straightforward call:
-
- var mock = new Mock<IHaveValue>();
- mock.Stub(v => v.Value);
-
- After the Stub call has been issued, setting and
- retrieving the object value will behave as expected:
-
- IHaveValue v = mock.Object;
-
- v.Value = 5;
- Assert.Equal(5, v.Value);
-
-
-
-
-
- Specifies that the given property should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. This overload
- allows setting the initial value for the property. (this is also
- known as "stubbing").
-
- Type of the property, inferred from the property
- expression (does not need to be specified).
- Property expression to stub.Initial value for the property.
- If you have an interface with an int property Value, you might
- stub it using the following straightforward call:
-
- var mock = new Mock<IHaveValue>();
- mock.SetupProperty(v => v.Value, 5);
-
- After the SetupProperty call has been issued, setting and
- retrieving the object value will behave as expected:
-
- IHaveValue v = mock.Object;
- // Initial value was stored
- Assert.Equal(5, v.Value);
-
- // New value set which changes the initial value
- v.Value = 6;
- Assert.Equal(6, v.Value);
-
-
-
-
-
- Specifies that the all properties on the mock should have "property behavior",
- meaning that setting its value will cause it to be saved and
- later returned when the property is requested. (this is also
- known as "stubbing"). The default value for each property will be the
- one generated as specified by the property for the mock.
-
- If the mock is set to ,
- the mocked default values will also get all properties setup recursively.
-
-
-
-
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IProcessor>();
- // exercise mock
- //...
- // Will throw if the test code didn't call Execute with a "ping" string argument.
- mock.Verify(proc => proc.Execute("ping"));
-
- The invocation was not performed on the mock.Expression to verify.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock,
- specifying a failure error message. Use in conjuntion with the default
- .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IProcessor>();
- // exercise mock
- //...
- // Will throw if the test code didn't call Execute with a "ping" string argument.
- mock.Verify(proc => proc.Execute("ping"));
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock,
- specifying a failure error message. Use in conjuntion with the default
- .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.
-
-
-
- Verifies that a specific invocation matching the given expression was performed on the mock. Use
- in conjuntion with the default .
-
- This example assumes that the mock has been used, and later we want to verify that a given
- invocation with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't call HasInventory.
- mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50));
-
- The invocation was not performed on the mock.Expression to verify.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock. Use in conjuntion
- with the default .
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock, specifying a failure
- error message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't call HasInventory.
- mock.Verify(warehouse => warehouse.HasInventory(TALISKER, 50), "When filling orders, inventory has to be checked");
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.Type of return value from the expression.
-
-
-
- Verifies that a specific invocation matching the given
- expression was performed on the mock, specifying a failure
- error message.
-
- The invocation was not call the times specified by
- .
- Expression to verify.The number of times a method is allowed to be called.Message to show if verification fails.Type of return value from the expression.
-
-
-
- Verifies that a property was read on the mock.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was retrieved from it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't retrieve the IsClosed property.
- mock.VerifyGet(warehouse => warehouse.IsClosed);
-
- The invocation was not performed on the mock.Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock, specifying a failure
- error message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was retrieved from it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't retrieve the IsClosed property.
- mock.VerifyGet(warehouse => warehouse.IsClosed);
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was read on the mock, specifying a failure
- error message.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
-
- Verifies that a property was set on the mock.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was set on it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed = true);
-
- The invocation was not performed on the mock.Expression to verify.
-
-
-
- Verifies that a property was set on the mock.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.
-
-
-
- Verifies that a property was set on the mock, specifying
- a failure message.
-
- This example assumes that the mock has been used,
- and later we want to verify that a given property
- was set on it:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed = true, "Warehouse should always be closed after the action");
-
- The invocation was not performed on the mock.Expression to verify.Message to show if verification fails.
-
-
-
- Verifies that a property was set on the mock, specifying
- a failure message.
-
- The invocation was not call the times specified by
- .
- The number of times a method is allowed to be called.Expression to verify.Message to show if verification fails.
-
-
-
- Raises the event referenced in using
- the given argument.
-
- The argument is
- invalid for the target event invocation, or the is
- not an event attach or detach expression.
-
- The following example shows how to raise a event:
-
- var mock = new Mock<IViewModel>();
-
- mock.Raise(x => x.PropertyChanged -= null, new PropertyChangedEventArgs("Name"));
-
-
- This example shows how to invoke an event with a custom event arguments
- class in a view that will cause its corresponding presenter to
- react by changing its state:
-
- var mockView = new Mock<IOrdersView>();
- var presenter = new OrdersPresenter(mockView.Object);
-
- // Check that the presenter has no selection by default
- Assert.Null(presenter.SelectedOrder);
-
- // Raise the event with a specific arguments data
- mockView.Raise(v => v.SelectionChanged += null, new OrderEventArgs { Order = new Order("moq", 500) });
-
- // Now the presenter reacted to the event, and we have a selected order
- Assert.NotNull(presenter.SelectedOrder);
- Assert.Equal("moq", presenter.SelectedOrder.ProductName);
-
-
-
-
-
- Raises the event referenced in using
- the given argument for a non-EventHandler typed event.
-
- The arguments are
- invalid for the target event invocation, or the is
- not an event attach or detach expression.
-
- The following example shows how to raise a custom event that does not adhere to
- the standard EventHandler:
-
- var mock = new Mock<IViewModel>();
-
- mock.Raise(x => x.MyEvent -= null, "Name", bool, 25);
-
-
-
-
-
- Exposes the mocked object instance.
-
-
-
-
- Provides legacy API members as extensions so that
- existing code continues to compile, but new code
- doesn't see then.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Obsolete.
-
-
-
-
- Provides additional methods on mocks.
-
-
- Provided as extension methods as they confuse the compiler
- with the overloads taking Action.
-
-
-
-
- Specifies a setup on the mocked type for a call to
- to a property setter, regardless of its value.
-
-
- If more than one setup is set for the same property setter,
- the latest one wins and is the one that will be executed.
-
- Type of the property. Typically omitted as it can be inferred from the expression.
- Type of the mock.
- The target mock for the setup.
- Lambda expression that specifies the property setter.
-
-
- mock.SetupSet(x => x.Suspended);
-
-
-
- This method is not legacy, but must be on an extension method to avoid
- confusing the compiler with the new Action syntax.
-
-
-
-
- Verifies that a property has been set on the mock, regarless of its value.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- Expression to verify.
- The mock instance.
- Mocked type.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, specifying a failure
- error message.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- Expression to verify.
- Message to show if verification fails.
- The mock instance.
- Mocked type.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, regardless
- of the value but only the specified number of times.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- The invocation was not call the times specified by
- .
- The mock instance.
- Mocked type.
- The number of times a method is allowed to be called.
- Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Verifies that a property has been set on the mock, regardless
- of the value but only the specified number of times, and specifying a failure
- error message.
-
-
- This example assumes that the mock has been used,
- and later we want to verify that a given invocation
- with specific parameters was performed:
-
- var mock = new Mock<IWarehouse>();
- // exercise mock
- //...
- // Will throw if the test code didn't set the IsClosed property.
- mock.VerifySet(warehouse => warehouse.IsClosed);
-
-
- The invocation was not performed on the mock.
- The invocation was not call the times specified by
- .
- The mock instance.
- Mocked type.
- The number of times a method is allowed to be called.
- Message to show if verification fails.
- Expression to verify.
- Type of the property to verify. Typically omitted as it can
- be inferred from the expression's return type.
-
-
-
- Helper for sequencing return values in the same method.
-
-
-
-
- Return a sequence of values, once per call.
-
-
-
-
- Casts the expression to a lambda expression, removing
- a cast if there's any.
-
-
-
-
- Casts the body of the lambda expression to a .
-
- If the body is not a method call.
-
-
-
- Converts the body of the lambda expression into the referenced by it.
-
-
-
-
- Checks whether the body of the lambda expression is a property access.
-
-
-
-
- Checks whether the expression is a property access.
-
-
-
-
- Checks whether the body of the lambda expression is a property indexer, which is true
- when the expression is an whose
- has
- equal to .
-
-
-
-
- Checks whether the expression is a property indexer, which is true
- when the expression is an whose
- has
- equal to .
-
-
-
-
- Creates an expression that casts the given expression to the
- type.
-
-
-
-
- TODO: remove this code when https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=331583
- is fixed.
-
-
-
-
- Provides partial evaluation of subtrees, whenever they can be evaluated locally.
-
- Matt Warren: http://blogs.msdn.com/mattwar
- Documented by InSTEDD: http://www.instedd.org
-
-
-
- Performs evaluation and replacement of independent sub-trees
-
- The root of the expression tree.
- A function that decides whether a given expression
- node can be part of the local function.
- A new tree with sub-trees evaluated and replaced.
-
-
-
- Performs evaluation and replacement of independent sub-trees
-
- The root of the expression tree.
- A new tree with sub-trees evaluated and replaced.
-
-
-
- Evaluates and replaces sub-trees when first candidate is reached (top-down)
-
-
-
-
- Performs bottom-up analysis to determine which nodes can possibly
- be part of an evaluated sub-tree.
-
-
-
-
- Ensures the given is not null.
- Throws otherwise.
-
-
-
-
- Ensures the given string is not null or empty.
- Throws in the first case, or
- in the latter.
-
-
-
-
- Checks an argument to ensure it is in the specified range including the edges.
-
- Type of the argument to check, it must be an type.
-
- The expression containing the name of the argument.
- The argument value to check.
- The minimun allowed value for the argument.
- The maximun allowed value for the argument.
-
-
-
- Checks an argument to ensure it is in the specified range excluding the edges.
-
- Type of the argument to check, it must be an type.
-
- The expression containing the name of the argument.
- The argument value to check.
- The minimun allowed value for the argument.
- The maximun allowed value for the argument.
-
-
-
- Implemented by all generated mock object instances.
-
-
-
-
- Implemented by all generated mock object instances.
-
-
-
-
- Reference the Mock that contains this as the mock.Object value.
-
-
-
-
- Reference the Mock that contains this as the mock.Object value.
-
-
-
-
- Implements the actual interception and method invocation for
- all mocks.
-
-
-
-
- Get an eventInfo for a given event name. Search type ancestors depth first if necessary.
-
- Name of the event, with the set_ or get_ prefix already removed
-
-
-
- Given a type return all of its ancestors, both types and interfaces.
-
- The type to find immediate ancestors of
-
-
-
- Implements the fluent API.
-
-
-
-
- Defines the Callback verb for property setter setups.
-
- Type of the property.
-
-
-
- Specifies a callback to invoke when the property is set that receives the
- property value being set.
-
- Callback method to invoke.
-
- Invokes the given callback with the property value being set.
-
- mock.SetupSet(x => x.Suspended)
- .Callback((bool state) => Console.WriteLine(state));
-
-
-
-
-
- Allows the specification of a matching condition for an
- argument in a method invocation, rather than a specific
- argument value. "It" refers to the argument being matched.
-
- This class allows the setup to match a method invocation
- with an arbitrary value, with a value in a specified range, or
- even one that matches a given predicate.
-
-
-
-
- Matches any value of the given type.
-
- Typically used when the actual argument value for a method
- call is not relevant.
-
-
- // Throws an exception for a call to Remove with any string value.
- mock.Setup(x => x.Remove(It.IsAny<string>())).Throws(new InvalidOperationException());
-
- Type of the value.
-
-
-
- Matches any value that satisfies the given predicate.
- Type of the argument to check.The predicate used to match the method argument.
- Allows the specification of a predicate to perform matching
- of method call arguments.
-
- This example shows how to return the value 1 whenever the argument to the
- Do method is an even number.
-
- mock.Setup(x => x.Do(It.Is<int>(i => i % 2 == 0)))
- .Returns(1);
-
- This example shows how to throw an exception if the argument to the
- method is a negative number:
-
- mock.Setup(x => x.GetUser(It.Is<int>(i => i < 0)))
- .Throws(new ArgumentException());
-
-
-
-
-
- Matches any value that is in the range specified.
- Type of the argument to check.The lower bound of the range.The upper bound of the range.
- The kind of range. See .
-
- The following example shows how to expect a method call
- with an integer argument within the 0..100 range.
-
- mock.Setup(x => x.HasInventory(
- It.IsAny<string>(),
- It.IsInRange(0, 100, Range.Inclusive)))
- .Returns(false);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
- The pattern to use to match the string argument value.
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression:
-
- mock.Setup(x => x.Check(It.IsRegex("[a-z]+"))).Returns(1);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
- The pattern to use to match the string argument value.The options used to interpret the pattern.
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression, in a case insensitive way:
-
- mock.Setup(x => x.Check(It.IsRegex("[a-z]+", RegexOptions.IgnoreCase))).Returns(1);
-
-
-
-
-
- Matcher to treat static functions as matchers.
-
- mock.Setup(x => x.StringMethod(A.MagicString()));
-
- public static class A
- {
- [Matcher]
- public static string MagicString() { return null; }
- public static bool MagicString(string arg)
- {
- return arg == "magic";
- }
- }
-
- Will succeed if: mock.Object.StringMethod("magic");
- and fail with any other call.
-
-
-
-
- Options to customize the behavior of the mock.
-
-
-
-
- Causes the mock to always throw
- an exception for invocations that don't have a
- corresponding setup.
-
-
-
-
- Will never throw exceptions, returning default
- values when necessary (null for reference types,
- zero for value types or empty enumerables and arrays).
-
-
-
-
- Default mock behavior, which equals .
-
-
-
-
- Exception thrown by mocks when setups are not matched,
- the mock is not properly setup, etc.
-
-
- A distinct exception type is provided so that exceptions
- thrown by the mock can be differentiated in tests that
- expect other exceptions to be thrown (i.e. ArgumentException).
-
- Richer exception hierarchy/types are not provided as
- tests typically should not catch or expect exceptions
- from the mocks. These are typically the result of changes
- in the tested class or its collaborators implementation, and
- result in fixes in the mock setup so that they dissapear and
- allow the test to pass.
-
-
-
-
-
- Supports the serialization infrastructure.
-
- Serialization information.
- Streaming context.
-
-
-
- Supports the serialization infrastructure.
-
- Serialization information.
- Streaming context.
-
-
-
- Made internal as it's of no use for
- consumers, but it's important for
- our own tests.
-
-
-
-
- Used by the mock factory to accumulate verification
- failures.
-
-
-
-
- Supports the serialization infrastructure.
-
-
-
-
- A strongly-typed resource class, for looking up localized strings, etc.
-
-
-
-
- Returns the cached ResourceManager instance used by this class.
-
-
-
-
- Overrides the current thread's CurrentUICulture property for all
- resource lookups using this strongly typed resource class.
-
-
-
-
- Looks up a localized string similar to Mock type has already been initialized by accessing its Object property. Adding interfaces must be done before that..
-
-
-
-
- Looks up a localized string similar to Value cannot be an empty string..
-
-
-
-
- Looks up a localized string similar to Can only add interfaces to the mock..
-
-
-
-
- Looks up a localized string similar to Can't set return value for void method {0}..
-
-
-
-
- Looks up a localized string similar to Constructor arguments cannot be passed for interface mocks..
-
-
-
-
- Looks up a localized string similar to A matching constructor for the given arguments was not found on the mocked type..
-
-
-
-
- Looks up a localized string similar to Could not locate event for attach or detach method {0}..
-
-
-
-
- Looks up a localized string similar to Expression {0} involves a field access, which is not supported. Use properties instead..
-
-
-
-
- Looks up a localized string similar to Type to mock must be an interface or an abstract or non-sealed class. .
-
-
-
-
- Looks up a localized string similar to Cannot retrieve a mock with the given object type {0} as it's not the main type of the mock or any of its additional interfaces.
- Please cast the argument to one of the supported types: {1}.
- Remember that there's no generics covariance in the CLR, so your object must be one of these types in order for the call to succeed..
-
-
-
-
- Looks up a localized string similar to The equals ("==" or "=" in VB) and the conditional 'and' ("&&" or "AndAlso" in VB) operators are the only ones supported in the query specification expression. Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to LINQ method '{0}' not supported..
-
-
-
-
- Looks up a localized string similar to Expression contains a call to a method which is not virtual (overridable in VB) or abstract. Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to Member {0}.{1} does not exist..
-
-
-
-
- Looks up a localized string similar to Method {0}.{1} is public. Use strong-typed Expect overload instead:
- mock.Setup(x => x.{1}());
- .
-
-
-
-
- Looks up a localized string similar to {0} invocation failed with mock behavior {1}.
- {2}.
-
-
-
-
- Looks up a localized string similar to Expected only {0} calls to {1}..
-
-
-
-
- Looks up a localized string similar to Expected only one call to {0}..
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at least {2} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at least once, but was never performed: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at most {3} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock at most once, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock between {2} and {3} times (Exclusive), but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock between {2} and {3} times (Inclusive), but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock exactly {2} times, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock should never have been performed, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to {0}
- Expected invocation on the mock once, but was {4} times: {1}.
-
-
-
-
- Looks up a localized string similar to All invocations on the mock must have a corresponding setup..
-
-
-
-
- Looks up a localized string similar to Object instance was not created by Moq..
-
-
-
-
- Looks up a localized string similar to Out expression must evaluate to a constant value..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not have a getter..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not exist..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} is write-only..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} is read-only..
-
-
-
-
- Looks up a localized string similar to Property {0}.{1} does not have a setter..
-
-
-
-
- Looks up a localized string similar to Cannot raise a mocked event unless it has been associated (attached) to a concrete event in a mocked object..
-
-
-
-
- Looks up a localized string similar to Ref expression must evaluate to a constant value..
-
-
-
-
- Looks up a localized string similar to Invocation needs to return a value and therefore must have a corresponding setup that provides it..
-
-
-
-
- Looks up a localized string similar to A lambda expression is expected as the argument to It.Is<T>..
-
-
-
-
- Looks up a localized string similar to Invocation {0} should not have been made..
-
-
-
-
- Looks up a localized string similar to Expression is not a method invocation: {0}.
-
-
-
-
- Looks up a localized string similar to Expression is not a property access: {0}.
-
-
-
-
- Looks up a localized string similar to Expression is not a property setter invocation..
-
-
-
-
- Looks up a localized string similar to Expression references a method that does not belong to the mocked object: {0}.
-
-
-
-
- Looks up a localized string similar to Invalid setup on a non-virtual (overridable in VB) member: {0}.
-
-
-
-
- Looks up a localized string similar to Type {0} does not implement required interface {1}.
-
-
-
-
- Looks up a localized string similar to Type {0} does not from required type {1}.
-
-
-
-
- Looks up a localized string similar to To specify a setup for public property {0}.{1}, use the typed overloads, such as:
- mock.Setup(x => x.{1}).Returns(value);
- mock.SetupGet(x => x.{1}).Returns(value); //equivalent to previous one
- mock.SetupSet(x => x.{1}).Callback(callbackDelegate);
- .
-
-
-
-
- Looks up a localized string similar to Unsupported expression: {0}.
-
-
-
-
- Looks up a localized string similar to Only property accesses are supported in intermediate invocations on a setup. Unsupported expression {0}..
-
-
-
-
- Looks up a localized string similar to Expression contains intermediate property access {0}.{1} which is of type {2} and cannot be mocked. Unsupported expression {3}..
-
-
-
-
- Looks up a localized string similar to Setter expression cannot use argument matchers that receive parameters..
-
-
-
-
- Looks up a localized string similar to Member {0} is not supported for protected mocking..
-
-
-
-
- Looks up a localized string similar to Setter expression can only use static custom matchers..
-
-
-
-
- Looks up a localized string similar to The following setups were not matched:
- {0}.
-
-
-
-
- Looks up a localized string similar to Invalid verify on a non-virtual (overridable in VB) member: {0}.
-
-
-
-
- Allows setups to be specified for protected members by using their
- name as a string, rather than strong-typing them which is not possible
- due to their visibility.
-
-
-
-
- Specifies a setup for a void method invocation with the given
- , optionally specifying arguments for the method call.
-
- The name of the void method to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
-
-
-
- Specifies a setup for an invocation on a property or a non void method with the given
- , optionally specifying arguments for the method call.
-
- The name of the method or property to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
- The return type of the method or property.
-
-
-
- Specifies a setup for an invocation on a property getter with the given
- .
-
- The name of the property.
- The type of the property.
-
-
-
- Specifies a setup for an invocation on a property setter with the given
- .
-
- The name of the property.
- The property value. If argument matchers are used,
- remember to use rather than .
- The type of the property.
-
-
-
- Specifies a verify for a void method with the given ,
- optionally specifying arguments for the method call. Use in conjuntion with the default
- .
-
- The invocation was not call the times specified by
- .
- The name of the void method to be verified.
- The number of times a method is allowed to be called.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
-
-
-
- Specifies a verify for an invocation on a property or a non void method with the given
- , optionally specifying arguments for the method call.
-
- The invocation was not call the times specified by
- .
- The name of the method or property to be invoked.
- The optional arguments for the invocation. If argument matchers are used,
- remember to use rather than .
- The number of times a method is allowed to be called.
- The type of return value from the expression.
-
-
-
- Specifies a verify for an invocation on a property getter with the given
- .
- The invocation was not call the times specified by
- .
-
- The name of the property.
- The number of times a method is allowed to be called.
- The type of the property.
-
-
-
- Specifies a setup for an invocation on a property setter with the given
- .
-
- The invocation was not call the times specified by
- .
- The name of the property.
- The number of times a method is allowed to be called.
- The property value.
- The type of the property. If argument matchers are used,
- remember to use rather than .
-
-
-
- Allows the specification of a matching condition for an
- argument in a protected member setup, rather than a specific
- argument value. "ItExpr" refers to the argument being matched.
-
-
- Use this variant of argument matching instead of
- for protected setups.
- This class allows the setup to match a method invocation
- with an arbitrary value, with a value in a specified range, or
- even one that matches a given predicate, or null.
-
-
-
-
- Matches a null value of the given type.
-
-
- Required for protected mocks as the null value cannot be used
- directly as it prevents proper method overload selection.
-
-
-
- // Throws an exception for a call to Remove with a null string value.
- mock.Protected()
- .Setup("Remove", ItExpr.IsNull<string>())
- .Throws(new InvalidOperationException());
-
-
- Type of the value.
-
-
-
- Matches any value of the given type.
-
-
- Typically used when the actual argument value for a method
- call is not relevant.
-
-
-
- // Throws an exception for a call to Remove with any string value.
- mock.Protected()
- .Setup("Remove", ItExpr.IsAny<string>())
- .Throws(new InvalidOperationException());
-
-
- Type of the value.
-
-
-
- Matches any value that satisfies the given predicate.
-
- Type of the argument to check.
- The predicate used to match the method argument.
-
- Allows the specification of a predicate to perform matching
- of method call arguments.
-
-
- This example shows how to return the value 1 whenever the argument to the
- Do method is an even number.
-
- mock.Protected()
- .Setup("Do", ItExpr.Is<int>(i => i % 2 == 0))
- .Returns(1);
-
- This example shows how to throw an exception if the argument to the
- method is a negative number:
-
- mock.Protected()
- .Setup("GetUser", ItExpr.Is<int>(i => i < 0))
- .Throws(new ArgumentException());
-
-
-
-
-
- Matches any value that is in the range specified.
-
- Type of the argument to check.
- The lower bound of the range.
- The upper bound of the range.
- The kind of range. See .
-
- The following example shows how to expect a method call
- with an integer argument within the 0..100 range.
-
- mock.Protected()
- .Setup("HasInventory",
- ItExpr.IsAny<string>(),
- ItExpr.IsInRange(0, 100, Range.Inclusive))
- .Returns(false);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
-
- The pattern to use to match the string argument value.
-
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression:
-
- mock.Protected()
- .Setup("Check", ItExpr.IsRegex("[a-z]+"))
- .Returns(1);
-
-
-
-
-
- Matches a string argument if it matches the given regular expression pattern.
-
- The pattern to use to match the string argument value.
- The options used to interpret the pattern.
-
- The following example shows how to expect a call to a method where the
- string argument matches the given regular expression, in a case insensitive way:
-
- mock.Protected()
- .Setup("Check", ItExpr.IsRegex("[a-z]+", RegexOptions.IgnoreCase))
- .Returns(1);
-
-
-
-
-
- Enables the Protected() method on ,
- allowing setups to be set for protected members by using their
- name as a string, rather than strong-typing them which is not possible
- due to their visibility.
-
-
-
-
- Enable protected setups for the mock.
-
- Mocked object type. Typically omitted as it can be inferred from the mock instance.
- The mock to set the protected setups on.
-
-
-
-
-
-
-
-
-
-
-
- Kind of range to use in a filter specified through
- .
-
-
-
-
- The range includes the to and
- from values.
-
-
-
-
- The range does not include the to and
- from values.
-
-
-
-
- Determines the way default values are generated
- calculated for loose mocks.
-
-
-
-
- Default behavior, which generates empty values for
- value types (i.e. default(int)), empty array and
- enumerables, and nulls for all other reference types.
-
-
-
-
- Whenever the default value generated by
- is null, replaces this value with a mock (if the type
- can be mocked).
-
-
- For sealed classes, a null value will be generated.
-
-
-
-
- A default implementation of IQueryable for use with QueryProvider
-
-
-
-
- The is a
- static method that returns an IQueryable of Mocks of T which is used to
- apply the linq specification to.
-
-
-
-
- Allows creation custom value matchers that can be used on setups and verification,
- completely replacing the built-in class with your own argument
- matching rules.
-
- See also .
-
-
-
-
- Provided for the sole purpose of rendering the delegate passed to the
- matcher constructor if no friendly render lambda is provided.
-
-
-
-
- Initializes the match with the condition that
- will be checked in order to match invocation
- values.
- The condition to match against actual values.
-
-
-
-
-
-
-
-
- This method is used to set an expression as the last matcher invoked,
- which is used in the SetupSet to allow matchers in the prop = value
- delegate expression. This delegate is executed in "fluent" mode in
- order to capture the value being set, and construct the corresponding
- methodcall.
- This is also used in the MatcherFactory for each argument expression.
- This method ensures that when we execute the delegate, we
- also track the matcher that was invoked, so that when we create the
- methodcall we build the expression using it, rather than the null/default
- value returned from the actual invocation.
-
-
-
-
- Allows creation custom value matchers that can be used on setups and verification,
- completely replacing the built-in class with your own argument
- matching rules.
- Type of the value to match.
- The argument matching is used to determine whether a concrete
- invocation in the mock matches a given setup. This
- matching mechanism is fully extensible.
-
- Creating a custom matcher is straightforward. You just need to create a method
- that returns a value from a call to with
- your matching condition and optional friendly render expression:
-
- [Matcher]
- public Order IsBigOrder()
- {
- return Match<Order>.Create(
- o => o.GrandTotal >= 5000,
- /* a friendly expression to render on failures */
- () => IsBigOrder());
- }
-
- This method can be used in any mock setup invocation:
-
- mock.Setup(m => m.Submit(IsBigOrder()).Throws<UnauthorizedAccessException>();
-
- At runtime, Moq knows that the return value was a matcher (note that the method MUST be
- annotated with the [Matcher] attribute in order to determine this) and
- evaluates your predicate with the actual value passed into your predicate.
-
- Another example might be a case where you want to match a lists of orders
- that contains a particular one. You might create matcher like the following:
-
-
- public static class Orders
- {
- [Matcher]
- public static IEnumerable<Order> Contains(Order order)
- {
- return Match<IEnumerable<Order>>.Create(orders => orders.Contains(order));
- }
- }
-
- Now we can invoke this static method instead of an argument in an
- invocation:
-
- var order = new Order { ... };
- var mock = new Mock<IRepository<Order>>();
-
- mock.Setup(x => x.Save(Orders.Contains(order)))
- .Throws<ArgumentException>();
-
-
-
-
-
- Tracks the current mock and interception context.
-
-
-
-
- Having an active fluent mock context means that the invocation
- is being performed in "trial" mode, just to gather the
- target method and arguments that need to be matched later
- when the actual invocation is made.
-
-
-
-
- A that returns an empty default value
- for non-mockeable types, and mocks for all other types (interfaces and
- non-sealed classes) that can be mocked.
-
-
-
-
- Allows querying the universe of mocks for those that behave
- according to the LINQ query specification.
-
-
- This entry-point into Linq to Mocks is the only one in the root Moq
- namespace to ease discovery. But to get all the mocking extension
- methods on Object, a using of Moq.Linq must be done, so that the
- polluting of the intellisense for all objects is an explicit opt-in.
-
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The type of the mocked object to query.
-
-
-
- Access the universe of mocks of the given type, to retrieve those
- that behave according to the LINQ query specification.
-
- The predicate with the setup expressions.
- The type of the mocked object to query.
-
-
-
- Creates an mock object of the indicated type.
-
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates an mock object of the indicated type.
-
- The predicate with the setup expressions.
- The type of the mocked object.
- The mocked object created.
-
-
-
- Creates the mock query with the underlying queriable implementation.
-
-
-
-
- Wraps the enumerator inside a queryable.
-
-
-
-
- Method that is turned into the actual call from .Query{T}, to
- transform the queryable query into a normal enumerable query.
- This method is never used directly by consumers.
-
-
-
-
- Extension method used to support Linq-like setup properties that are not virtual but do have
- a getter and a setter, thereby allowing the use of Linq to Mocks to quickly initialize Dtos too :)
-
-
-
-
- Helper extensions that are used by the query translator.
-
-
-
-
- Retrieves a fluent mock from the given setup expression.
-
-
-
-
- Defines the number of invocations allowed by a mocked method.
-
-
-
-
- Specifies that a mocked method should be invoked times as minimum.
- The minimun number of times.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked one time as minimum.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked time as maximun.
- The maximun number of times.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked one time as maximun.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked between and
- times.
- The minimun number of times.The maximun number of times.
- The kind of range. See .
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked exactly times.
- The times that a method or property can be called.An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should not be invoked.
- An object defining the allowed number of invocations.
-
-
-
- Specifies that a mocked method should be invoked exactly one time.
- An object defining the allowed number of invocations.
-
-
-
- Determines whether the specified is equal to this instance.
-
- The to compare with this instance.
-
- true if the specified is equal to this instance; otherwise, false.
-
-
-
-
- Returns a hash code for this instance.
-
- A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
-
-
-
-
- Determines whether two specified objects have the same value.
-
- The first .
-
- The second .
-
- true if the value of left is the same as the value of right; otherwise, false.
-
-
-
-
- Determines whether two specified objects have different values.
-
- The first .
-
- The second .
-
- true if the value of left is different from the value of right; otherwise, false.
-
-
-
-
diff --git a/Lib/Newtonsoft.Json.Silverlight.dll b/Lib/Newtonsoft.Json.Silverlight.dll
deleted file mode 100644
index 7604c49..0000000
Binary files a/Lib/Newtonsoft.Json.Silverlight.dll and /dev/null differ
diff --git a/Lib/Newtonsoft.Json.dll b/Lib/Newtonsoft.Json.dll
deleted file mode 100644
index 389329d..0000000
Binary files a/Lib/Newtonsoft.Json.dll and /dev/null differ
diff --git a/Lib/NewtonsoftJsonMonoTouch.dll b/Lib/NewtonsoftJsonMonoTouch.dll
deleted file mode 100755
index ca8c31d..0000000
Binary files a/Lib/NewtonsoftJsonMonoTouch.dll and /dev/null differ
diff --git a/Lib/Ploeh.AutoFixture.xml b/Lib/Ploeh.AutoFixture.xml
deleted file mode 100644
index 7417cef..0000000
--- a/Lib/Ploeh.AutoFixture.xml
+++ /dev/null
@@ -1,5161 +0,0 @@
-
-
-
- Ploeh.AutoFixture
-
-
-
-
- A Decorator of that applies behaviors when
- is invoked.
-
- The type of specimen to customize.
-
-
- In this context, a behavior is an that
- is used to decorate the composed by the decorated
- with decorating builders.
-
-
- This can be used to ensure that the composed builder is decorated with appropriate builders
- such as or .
-
-
-
-
-
- Provides statements that can be used to control how specimens are created and
- post-processed.
-
- The type of specimen to customize.
-
-
-
- Provides statements that can be used to control how specimens are created.
-
- The type of specimen.
-
-
-
- Composes instances of .
-
-
-
-
- Composes a new instance.
-
- A new instance.
-
-
-
- Specifies a function that defines how to create a specimen from a seed.
-
- The factory used to create specimens from seeds.
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies an that can create specimens of the
- appropriate type. Mostly for advanced scenarios.
-
-
- An that can create specimens of the appropriate type.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
- This method is mostly intended for advanced scenarios where a more loosely coupled
- strategy is desired to create specimens, but the advantages of the strongly typed
- are still desired for post-processing.
-
-
- One possible scenario is for post-processing of interfaces or abstract types where
- auto-mocking is desired to create the instance. This method makes it possible to supply
- an auto-mocking .
-
-
- must be able to create specimens of the requested type, or
- exceptions may be thrown.
-
-
-
-
-
- Specifies that an anonymous object should be created in a particular way; often by
- using a constructor.
-
-
- A function that will be used to create the object. This will often be a constructor.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using a single input
- parameter for the factory.
-
-
- The type of input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes a single constructor argument of type .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using two input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes two constructor arguments of type and
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using three input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- The type of the third input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes three constructor arguments of type ,
- and .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using four input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- The type of the third input parameter to use when invoking .
-
-
- The type of the fourth input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes three constructor arguments of type ,
- , and
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Provides statements that can be used to control how specimens are post-processed.
-
- The type of specimen.
-
-
-
- Performs the specified action on a specimen.
-
- The action to perform.
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Disables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned an anonymous value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will should have a value
- assigned.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned a specific value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will have
- assigned.
-
-
- The value to assign to the property or field identified by
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Enables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property should not be assigned any automatic value as
- part of specimen post-processing.
-
- The type of the property or field to ignore.
-
- An expression that identifies the property or field to be ignored.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Initializes a new instance of the class.
-
- The composer to decorate.
-
- The behaviors which will be applied when is invoked.
-
-
-
-
- Initializes a new instance of the class.
-
- The composer to decorate.
-
- The behaviors which will be applied when is invoked.
-
-
-
-
- Returns a new that decorates the new composer, but
- otherwise preserves other state information of the instance (such as the
- .
-
- The new composer to decorate.
-
- A new that decorates .
-
-
-
-
- Returns a new that decorates the new
- composer, but otherwise preserves other state information of the instance (such as the
- .
-
- The new composer to decorate.
-
- A new that decorates
- .
-
-
-
-
- Specifies a function that defines how to create a specimen from a seed.
-
- The factory used to create specimens from seeds.
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies an that can create specimens of the
- appropriate type. Mostly for advanced scenarios.
-
-
- An that can create specimens of the appropriate type.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that an anonymous object should be created in a particular way; often by
- using a constructor.
-
-
- A function that will be used to create the object. This will often be a constructor.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that an anonymous object should be created in a particular way; often by
- using a constructor.
-
-
- A function that will be used to create the object. This will often be a constructor.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using two input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes two constructor arguments of type and
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using three input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- The type of the third input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes three constructor arguments of type ,
- and .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using four input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- The type of the third input parameter to use when invoking .
-
-
- The type of the fourth input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes three constructor arguments of type ,
- , and
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Composes a new instance.
-
-
- A new instance.
-
-
-
- The return value is created from the instances created
- by the decorated , itself decorated with the decorating builders
- created by .
-
-
-
-
-
- Performs the specified action on a specimen.
-
- The action to perform.
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Disables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned an anonymous value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will should have a value
- assigned.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned a specific value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will have
- assigned.
-
-
- The value to assign to the property or field identified by
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Enables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property should not be assigned any automatic value as
- part of specimen post-processing.
-
- The type of the property or field to ignore.
-
- An expression that identifies the property or field to be ignored.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Gets the behaviors that will be applied when is invoked.
-
-
-
-
- Gets the decorated composer.
-
-
-
-
- A Decorator of that applies behaviors when
- is invoked.
-
- The type of specimen to customize.
-
-
- In this context, a behavior is an that
- is used to decorate the composed by the decorated
- with decorating builders.
-
-
- This can be used to ensure that the composed builder is decorated with appropriate builders
- such as or .
-
-
-
-
-
- Initializes a new instance of the
- class.
-
- The composer to decorate.
-
- The behaviors which will be applied when is invoked.
-
-
-
-
- Initializes a new instance of the class.
-
- The composer to decorate.
-
- The behaviors which will be applied when is invoked.
-
-
-
-
- Returns a new that decorates the new
- composer, but otherwise preserves other state information of the instance (such as the
- .
-
- The new composer to decorate.
-
- A new that decorates
- .
-
-
-
-
- Performs the specified action on a specimen.
-
- The action to perform.
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Disables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned an anonymous value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will should have a value
- assigned.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned a specific value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will have
- assigned.
-
-
- The value to assign to the property or field identified by
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Enables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property should not be assigned any automatic value as
- part of specimen post-processing.
-
- The type of the property or field to ignore.
-
- An expression that identifies the property or field to be ignored.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Composes a new instance.
-
-
- A new instance.
-
-
-
- The return value is created from the instances created
- by the decorated , itself decorated with the decorating builders
- created by .
-
-
-
-
-
- Gets the behaviors that will be applied when is invoked.
-
-
-
-
- Gets the decorated composer.
-
-
-
-
- Contains extension methods for populating collections with specimens.
-
-
-
-
- Adds many objects to a list.
-
- The type of object contained within the list.
- The collection to which objects should be added.
-
- A function that will be called many times to create objects that will be added to
- .
-
- The number of times is invoked, and hence the number of
- items added to .
-
-
-
-
- Adds many anonymously created objects to a list.
-
- The type of object that is contained in the list.
- The fixture.
-
- The list to which the anonymously created objects will be added.
-
-
-
- The number of objects created and added is determined by
- .
-
-
-
-
-
-
-
- Adds many anonymously created objects to a list.
-
- The type of object that is contained in the list.
- The fixture.
-
- The list to which the anonymously created objects will be added.
-
- The number of objects created and added.
-
-
-
-
-
- Adds many objects to a list using the provided function to create each object.
-
- The type of object that is contained in the list.
- The fixture.
-
- The list to which the created objects will be added.
-
-
- The function that creates each object which is subsequently added to
- .
-
-
-
- The number of objects created and added is determined by
- .
-
-
-
-
-
-
-
- Customizes an by using all contained .
-
-
-
-
- Encapsulates a customization of an .
-
-
-
-
- Customizes the specified fixture.
-
- The fixture to customize.
-
-
-
- Initializes a new instance of the class.
-
- The customizations.
-
-
-
- Initializes a new instance of the class.
-
- The customizations.
-
-
-
- Customizes the specified fixture.
-
- The fixture to customize.
-
-
-
- Gets the customizations contained within this instance.
-
-
-
-
- Creates new instances.
-
-
-
-
- Builds, or partakes in building, anonymous variables (specimens).
-
-
-
-
- Creates a new specimen based on a request.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The requested specimen if possible; otherwise a instance.
-
-
-
- The can be any object, but will often be a
- or other instances.
-
-
- Note to implementers: Implementations are expected to return a
- instance if they can't satisfy the request.
-
-
-
-
-
- Creates a new instance.
-
- The request that describes what to create.
- Not used.
-
- A new instance, if is a request for a
- ; otherwise, a instance.
-
-
-
-
- Supplies instances that can resolve requests for many common
- primitives, such as and .
-
-
-
-
- Returns an enumerator that iterates through the collection.
-
-
- A that can be used to iterate
- through the collection.
-
-
-
-
- Returns an enumerator that iterates through a collection.
-
-
- An object that can be used to iterate
- through the collection.
-
-
-
-
- Enables composition customization of a single type of specimen.
-
- The type of specimen.
-
-
-
- Composes a that targets a particular .
-
-
-
-
- Initializes a new instance of the class.
-
-
- The targeted by the created by
- .
-
-
- The factory that creates instances of .
-
-
-
-
- Composes a new instance.
-
-
- A new instance with appropriate filters that targets
- .
-
-
-
-
- Gets the factory that creates instance of .
-
-
-
-
- Gets the targeted .
-
-
-
-
- Gets the input filter.
-
-
-
-
- Gets the transformations that will be applied to during
- .
-
-
-
-
- A tranformation that decorates an with an appropriate
- .
-
-
-
-
- Transforms one instance into another.
-
-
-
-
- Transforms the supplied builder into another.
-
- The builder to transform.
-
- A new created from .
-
-
-
- Note to implementers: In most scenarios, the transformation is expected to maintain
- behavior of ; usually by applying a Decorator.
-
-
-
-
-
- Initializes a new instance of the class.
-
- The target .
-
-
-
- Transforms the supplied builder into another.
-
- The builder to transform.
-
- A new created from .
-
-
-
- Although a throws if the decorated
- returns a , this
- transformation permits NoSpecimen return values if the request is a
- for the . This enables the
- engine to retry the request with the unwrapped request.
-
-
-
-
-
- A transformation that combines an with a
- .
-
-
-
-
- Transforms the supplied builder into another.
-
- The builder to transform.
-
- A new created from .
-
-
-
- This method combines with a
- . This ensures that if the original builder cannot
- deal with a the request is immediately retried with the
- unwrapped request.
-
-
-
-
-
- A transformation that decorates an with a filter that
- filters according to a target type.
-
-
-
-
- Initializes a new instance of the class.
-
- The input filter.
-
-
-
- Transforms the supplied builder into another.
-
- The builder to transform.
-
- A new created from .
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class.
-
-
- A factory which will be used to create specimen instances.
-
-
- Post-processors that will be executed on each created specimen.
-
-
- Enables auto properties if set to .
-
-
-
-
- Controls whether auto-properties will be enabled or not.
-
- Set to to enable auto-properties.
-
- A new instance of with set
- to the value of .
-
-
-
-
- Controls which factory will be used when specimens are created.
-
- The factory.
-
- A new instance of with
- set to the value of
- .
-
-
-
-
- Adds a post-processor to the customization.
-
- The postprocessor to add.
-
- A new instance of with added
- to .
-
-
-
-
- Specifies a function that defines how to create a specimen from a seed.
-
- The factory used to create specimens from seeds.
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies an that can create specimens of the
- appropriate type. Mostly for advanced scenarios.
-
-
- An that can create specimens of the appropriate type.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that an anonymous object should be created in a particular way; often by
- using a constructor.
-
-
- A function that will be used to create the object. This will often be a constructor.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using a single input
- parameter for the factory.
-
-
- The type of input parameter to use when invoking
- .
-
- A function that will be used to create the object. This will often be a constructor
- that takes a single constructor argument of type .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using two input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes two constructor arguments of type and
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using three input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- The type of the third input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes three constructor arguments of type ,
- and .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using four input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- The type of the third input parameter to use when invoking .
-
-
- The type of the fourth input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes three constructor arguments of type ,
- , and
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Performs the specified action on a specimen.
-
- The action to perform.
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Disables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned an anonymous value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will should have a value
- assigned.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned a specific value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will have
- assigned.
-
-
- The value to assign to the property or field identified by
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Enables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Withouts the specified property picker.
-
- The type of the property.
- The property picker.
-
-
-
-
- Gets a value indicating whether writable properties and fields will be assigned with
- anonymous values.
-
-
-
-
- Gets the postprocessors that will be executed on each created specimen.
-
-
-
-
- Gets the transformations that will be applied to
- during
- .
-
-
-
- These transformations compose the appropriate post-processors according to the rules
- encapsulated by the instance.
-
-
-
-
-
- A transformation that decorates an with the appropriate
- postprocessor.
-
-
-
-
- Initializes a new instance of the
- class.
-
- The postprocessors.
-
-
-
- Transforms the supplied builder into another.
-
- The builder to transform.
-
- A new created from .
-
-
-
-
- A transformation that decorates an with a post-processor
- that applies the appropriate auto-properties.
-
-
-
-
- Initializes a new instance of the
- class.
-
- The postprocessors.
- The input filter.
-
- Indicates whether auto-properties are enabled.
-
-
-
-
- Transforms the supplied builder into another.
-
- The builder to transform.
-
- A new created from .
-
-
-
-
- Aggregates an arbitrary number of instances.
-
- The type of specimen to customize.
-
-
-
- Initializes a new instance of the class
- with a sequence of instances.
-
- The composers to aggregate.
-
-
-
- Initializes a new instance of the class
- with an array of instances.
-
- The composers to aggregate.
-
-
-
- Specifies a function that defines how to create a specimen from a seed.
-
- The factory used to create specimens from seeds.
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies an that can create specimens of the
- appropriate type. Mostly for advanced scenarios.
-
-
- An that can create specimens of the appropriate type.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that an anonymous object should be created in a particular way; often by
- using a constructor.
-
-
- A function that will be used to create the object. This will often be a constructor.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using a single input
- parameter for the factory.
-
-
- The type of input parameter to use when invoking
- .
-
- A function that will be used to create the object. This will often be a constructor
- that takes a single constructor argument of type .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using two input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes two constructor arguments of type and
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using three input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- The type of the third input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes three constructor arguments of type ,
- and .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Specifies that a specimen should be created in a particular way, using four input
- parameters for the construction.
-
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- The type of the third input parameter to use when invoking .
-
-
- The type of the fourth input parameter to use when invoking .
-
-
- A function that will be used to create the object. This will often be a constructor
- that takes three constructor arguments of type ,
- , and
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Performs the specified action on a specimen.
-
- The action to perform.
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Disables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned an anonymous value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will should have a value
- assigned.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned a specific value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will have
- assigned.
-
-
- The value to assign to the property or field identified by
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Enables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property should not be assigned any automatic value as
- part of specimen post-processing.
-
- The type of the property or field to ignore.
-
- An expression that identifies the property or field to be ignored.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Composes a new instance.
-
-
- A new instance.
-
-
-
-
- Gets the aggregated composers.
-
-
-
-
- Aggregates an arbitrary number of instances.
-
- The type of specimen to customize.
-
-
-
- Initializes a new instance of the
- class with a sequence of instances.
-
- The composers to aggregate.
-
-
-
- Initializes a new instance of the
- class with an array of instances.
-
- The composers to aggregate.
-
-
-
- Performs the specified action on a specimen.
-
- The action to perform.
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Disables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned an anonymous value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will should have a value
- assigned.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property or field should be assigned a specific value as
- part of specimen post-processing.
-
- The type of the property of field.
-
- An expression that identifies the property or field that will have
- assigned.
-
-
- The value to assign to the property or field identified by
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Enables auto-properties for a type of specimen.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Registers that a writable property should not be assigned any automatic value as
- part of specimen post-processing.
-
- The type of the property or field to ignore.
-
- An expression that identifies the property or field to be ignored.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
-
- Composes a new instance.
-
-
- A new instance.
-
-
-
-
- Gets the aggregated composers.
-
-
-
-
- Supplies instances that can be used to implement the default
- engine of AutoFixture.
-
-
-
-
- Supplies instances that works as AutoFixture's
- 'transmission'. Without those builders, very little is likely to work.
-
-
-
-
- Represents an Equivalence Class for the concept of Many.
-
-
-
-
- Gets or sets the count that specifies how many Many is.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Returns an enumerator that iterates through the collection.
-
-
- A that can be used to iterate
- through the collection.
-
-
-
-
- Returns an enumerator that iterates through a collection.
-
-
- An object that can be used to iterate
- through the collection.
-
-
-
-
- Gets or sets the count that specifies how many Many is.
-
-
-
-
- Initializes a new instance of the class with
- an instance of .
-
-
-
-
- Initializes a new instance of the class with the
- supplied sequence of .
-
-
- The builders to use instead of .
-
-
-
-
- Initializes a new instance of the class with the
- supplied array of .
-
-
- The builders to use instead of .
-
-
-
-
- Returns an enumerator that iterates through the collection.
-
-
- A that can be used to iterate
- through the collection.
-
-
-
-
- Generates enum values in a round-robin fashion.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates a new enum value based on a request.
-
- The request that describes what to create.
-
- A context that can be used to create other specimens. Not used.
-
-
- An enum value if appropriate; otherwise a instance.
-
-
-
- If is a that represents an enum, an
- instance of that enum is returned. Differing values are returned, starting with the
- first value. When all values of the enum type have been served, the sequence starts
- over again.
-
-
-
-
-
- Contains extension methods for freezing specimens in instances.
-
-
-
-
- Freezes the type to a single value.
-
- The type to freeze.
- The fixture.
-
- The value that will subsequently always be created for .
-
-
-
- The method freezes the type to always return the same
- instance whenever an instance of the type is requested either directly, or indirectly as a
- nested value of other types.
-
-
-
-
-
-
-
- Freezes the type to a single value.
-
- The type to freeze.
- The fixture.
-
- Any data that adds additional information when creating the anonymous object.
-
-
- The value that will subsequently always be created for .
-
-
-
- The method freezes the type to always return the
- same instance whenever an instance of the type is requested either directly, or
- indirectly as a nested value of other types.
-
-
-
-
-
-
-
- Freezes the type to a single value.
-
- The type to freeze.
- The fixture.
-
- A function that customizes a given and returns
- the modified composer.
-
-
- The value that will subsequently always be created for .
-
-
-
- The method freezes the type to always return the
- same instance whenever an instance of the type is requested either directly, or
- indirectly as a nested value of other types. The frozen instance is created by an
- that is the result of applying the
- .
-
-
-
-
-
-
-
- Contains extension methods for registering specimens in instances.
-
-
-
-
- Injects a specific instance for a specific type.
-
-
- The type for which should be injected.
-
- The fixture.
- The item to inject.
-
-
-
- Registers a creation function for a specifc type.
-
-
- The type for which should be registered.
-
- The fixture.
-
- A function that will be used to create objects of type every
- time the is asked to create an object of that type.
-
-
-
-
- Registers a creation function for a specific type, when that creation function requires
- a single input parameter.
-
-
- The type of the input parameter used by .
-
-
- The type for which should be registered.
-
- The fixture.
-
- A function that will be used to create objects of type every
- time the is asked to create an object of that type.
-
-
-
-
- Registers a creation function for a specific type, when that creation function requires
- two input parameters.
-
-
- The type of the first input parameter used by .
-
-
- The type of the second input parameter used by .
-
-
- The type for which should be registered.
-
- The fixture.
-
- A function that will be used to create objects of type every
- time the is asked to create an object of that type.
-
-
-
-
- Registers a creation function for a specific type, when that creation function requires
- three input parameters.
-
-
- The type of the first input parameter used by .
-
-
- The type of the second input parameter used by .
-
-
- The type of the third input parameter used by .
-
-
- The type for which should be registered.
-
- The fixture.
-
- A function that will be used to create objects of type every
- time the is asked to create an object of that type.
-
-
-
-
- Registers a creation function for a specific type, when that creation function requires
- four input parameters.
-
-
- The type of the first input parameter used by .
-
-
- The type of the second input parameter used by .
-
-
- The type of the third input parameter used by .
-
-
- The type of the fourth input parameter used by .
-
-
- The type for which should be registered.
-
- The fixture.
-
- A function that will be used to create objects of type every
- time the is asked to create an object of that type.
-
-
-
-
- A customization that will freeze a specimen of a given .
-
-
-
-
- Initializes a new instance of the class.
-
- The to freeze.
-
-
-
- Customizes the fixture by freezing the value of .
-
- The fixture to customize.
-
-
-
- Gets the to freeze.
-
-
-
-
- Provides anonymous object creation services.
-
-
-
-
- Customizes the creation algorithm for a single object.
-
-
- The type of object for which the algorithm should be customized.
-
-
- A that can be used to customize the creation
- algorithm before creating the object.
-
-
-
-
- Applies a customization.
-
- The customization to apply.
- An where the customization is applied.
-
-
- Note to implementers: the returned is expected to have
- applied. Whether the return value is the same instance
- as the current instance, or a copy is unspecfied.
-
-
-
-
-
- Customizes the creation algorithm for all objects of a given type.
-
- The type of object to customize.
-
- A function that customizes a given and returns
- the modified composer.
-
-
-
-
- Gets the behaviors that are applied when
- is invoked.
-
-
-
-
- Gets customizations that will take into
- accout.
-
-
-
- It is expected that customizations pre-empt whichever other
- is created by
- .
-
-
-
-
-
- Gets or sets if writable properties should generally be assigned a value when
- generating an anonymous object.
-
-
-
-
- Gets or sets a number that controls how many objects are created when a
- creates more than one anonymous objects.
-
-
-
-
- Gets the residue collectors that will
- take into account.
-
-
-
- It is expected that residue collectors provide fallback mechanisms if no ealier
- can handle a request.
-
-
-
-
-
- Relays a request for an array to a and converts the result
- to the desired array type.
-
-
-
-
- Creates a new array based on a request.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- An array of the requested type if possible; otherwise a
- instance.
-
-
-
- If is a request for an array and
- can satisfy a for the element type, the return value is a
- populated array of the requested type. If not, the return value is a
- instance.
-
-
-
-
-
- A that always returns the same specimen.
-
-
-
-
- Initializes a new instance of the class.
-
-
- The specimen to return from the method.
-
-
-
-
- Returns the same specimen every time.
-
- The request that describes what to create. Ignored.
-
- A context that can be used to create other specimens. Ignored.
-
-
- The specimen supplied to the instance in the constructor.
-
-
-
-
-
- Defines a strategy for selecting constructors from a type.
-
-
-
-
- Selects the constructors for the supplied type.
-
- The type.
- Constructors for .
-
-
-
- An that does not customize anything, but can still
- compose an - typically by returning the instance it is
- configured to use.
-
-
-
-
-
- Initializes a new instance of the class.
-
-
-
- Initialized in this way, will return an empty
- .
-
-
-
-
-
- Initializes a new instance of the class with an
- that will be returned by the
- method.
-
-
- The builder to return by the method.
-
-
-
-
- Initializes a new instance of the class with a
- function used to implement the method.
-
-
- The function that will be used to implement .
-
-
-
-
- Does nothing.
-
- Ignored.
- The current instance.
-
-
-
- Does nothing.
-
- Ignored.
- The current instance.
-
-
-
- Does nothing
-
- Ignored.
- The current instance.
-
-
-
- Does nothing
-
- Ignored.
- The current instance.
-
-
-
- Does nothing
-
- Ignored.
- The current instance.
-
-
-
- Does nothing
-
- Ignored.
- The current instance.
-
-
-
- Does nothing
-
- Ignored.
- The current instance.
-
-
-
- Does nothing
-
- Ignored.
- The current instance.
-
-
-
- Does nothing
-
- The current instance.
-
-
-
- Does nothing
-
- Ignored.
- The current instance.
-
-
-
- Does nothing
-
- Ignored.
- Ignored.
- The current instance.
-
-
-
- Does nothing
-
- The current instance.
-
-
-
- Does nothing
-
- Ignored.
- The current instance.
-
-
-
- Composes a new instance.
-
-
- An instance.
-
-
-
- Which is returned depends on how the
- instance was configured through its constructor.
-
-
-
-
-
- Provides extension methods for backwards compatibility.
-
-
-
-
- Specifies that an anonymous object should be created in a particular way; often by
- using a constructor.
-
- An instance.
-
- A function that will be used to create the object. This will often be a constructor.
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
- This method is deprecated. Use
- instead.
-
-
-
-
-
- Specifies that a specimen should be created in a particular way, using a single input
- parameter for the factory.
-
- The type of specimen to create.
-
- The type of input parameter to use when invoking
- .
- An instance.
-
- A function that will be used to create the object. This will often be a constructor
- that takes a single constructor argument of type .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
- This method is deprecated. Use
- instead.
-
-
-
-
-
- Specifies that a specimen should be created in a particular way, using two input
- parameters for the construction.
-
- The type of specimen to create.
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
- An instance.
-
- A function that will be used to create the object. This will often be a constructor
- that takes two constructor arguments of type and
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
- This method is deprecated. Use
-
- instead.
-
-
-
-
-
- Specifies that a specimen should be created in a particular way, using three input
- parameters for the construction.
-
- The type of specimen to create.
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- The type of the third input parameter to use when invoking .
-
- An instance.
-
- A function that will be used to create the object. This will often be a constructor
- that takes three constructor arguments of type ,
- and .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
- This method is deprecated. Use
-
- instead.
-
-
-
-
-
- Specifies that a specimen should be created in a particular way, using four input
- parameters for the construction.
-
- The type of specimen to create.
-
- The type of the first input parameter to use when invoking .
-
-
- The type of the second input parameter to use when invoking .
-
-
- The type of the third input parameter to use when invoking .
-
-
- The type of the fourth input parameter to use when invoking .
-
- An instance.
-
- A function that will be used to create the object. This will often be a constructor
- that takes three constructor arguments of type ,
- , and
- .
-
-
- An which can be used to further customize the
- post-processing of created specimens.
-
-
-
- This method is deprecated. Use
-
- instead.
-
-
-
-
-
- A boolean 'And' Composite .
-
-
-
-
- A Specification that evaluates requests.
-
-
-
- This is a codification of the Specification patter for requests. This interface can (and
- should) be used in any place where you need to filter requests for specimens.
-
-
-
-
-
- Evaluates a request for a specimen.
-
- The specimen request.
-
- if is satisfied by the Specification;
- otherwise, .
-
-
-
-
- Initializes a new instance of the with the
- supplied specifications.
-
- An array of .
-
-
-
- Initializes a new instance of the class with the
- supplied specifications.
-
- A sequence of .
-
-
-
- Evaluates a request for a specimen.
-
- The specimen request.
-
- if is satisfied by all
- ; otherwise, .
-
-
-
-
- Gets the decorated specifications.
-
-
-
-
- A specification that evaluates whether a request is a request for a type.
-
-
-
-
- Evaluates a request for a specimen.
-
- The specimen request.
-
- if is a ;
- otherwise, .
-
-
-
-
- A command that assigns anonymous values to all writable properties and fields of a type.
-
-
-
-
- A command that assigns anonymous values to all writable properties and fields of a type.
-
- The specimen type on which properties are assigned.
-
-
-
- A Command that performs an action on a specimen and knows whether that action matches a
- given request.
-
- The type of specimen on which the command acts.
-
-
-
- Executes the command on the supplied specimen.
-
- The specimen on which the command is executed.
-
- An that can be used to resolve other requests.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with the
- the supplied specification.
-
-
- A specification that is used as a filter to include properties or fields.
-
-
-
- Only properties or fields satisfied by will get
- assigned values.
-
-
-
-
-
- Assigns anonymous values to properties and fields on a specimen
-
-
- The specimen on which property and field values will be assigned.
-
-
- An that is used to create property and field values.
-
-
-
-
- Evaluates whether a request matches a property or field affected by this command.
-
- The specimen request.
-
- if is a
- or that identifies a property or field affected by this
- ; otherwise, .
-
-
-
-
- Gets the type of the specimen.
-
- The specimen.
- The type of the specimen.
-
-
- This implementation ignores and returns the type parameter
- of .
-
-
-
-
-
- Initializes a new instance of the class.
-
-
-
- When created without an explicit specimen type, the
- will infer the specimen type from the actual specimen instance.
-
-
-
-
-
- Initializes a new instance of the class with the
- supplied specimen type.
-
- The specimen type on which properties are assigned.
-
-
-
- Initializes a new instance of the class with the
- supplied specimen type and specification.
-
- The specimen type on which properties are assigned.
-
- A specification that is used as a filter to include properties or fields.
-
-
-
- Only properties or fields satisfied by will get
- assigned values.
-
-
-
-
-
- Gets the type of the specimen.
-
- The specimen.
- The type of the specimen.
-
- This implementation may ignore and instead return the type
- passed to the constructor.
-
-
-
-
- A that is always .
-
-
-
-
- Evaluates a request for a specimen.
-
- The specimen request.
-
- .
-
-
-
-
- Relays a request for a field to a with a seed based
- on the field's name.
-
-
-
-
- Creates a new specimen based on a requested field.
-
- The request that describes what to create.
- A container that can be used to create other specimens.
-
- A specimen created from a encapsulating the field type
- and name of the requested field, if possible; otherwise, a
- instance.
-
-
-
-
- Decorates an and filters requests so that only some requests
- are passed through to the decorated builder.
-
-
-
-
- Initializes a new instance of the class.
-
- A specimen builder to decorate.
-
- A specification that determines whether will receive the request.
-
-
-
-
- Creates a new specimen based on a request.
-
- The request that describes what to create.
- A container that can be used to create other specimens.
-
- A specimen created by the decorated if the filter allows
- the request through; otherwise, a instance.
-
-
-
-
- Gets the decorated builder.
-
-
-
-
- Gets the specification that determines whether will be invoked or
- not.
-
-
-
-
- Decorates an and returns the opposite result.
-
-
-
-
- Initializes a new instance of the by
- decorating the supplied specification.
-
-
- The to decorate.
-
-
-
-
- Returns the opposite result as the decorated .
-
- The specimen request.
-
- if the decorated returns
- ; otherwise, .
-
-
-
-
- Gets the decorated specification.
-
-
-
- This is the that will be inverted.
-
-
-
-
-
- Signals that many similar instances are requested.
-
-
-
-
- Initializes a new instance of the class.
-
- The underlying request to muliply.
- The number of instances requested.
-
-
-
- Determines whether the specified is equal to this instance.
-
- The to compare with this instance.
-
- if the specified is equal to this instance;
- otherwise, .
-
-
- The parameter is null.
-
-
-
-
- Returns a hash code for this instance.
-
-
- A hash code for this instance, suitable for use in hashing algorithms and data
- structures like a hash table.
-
-
-
-
- Creates many requests from the underlying requests.
-
- A number of similar requests.
-
- When both the requested count and are negative or zero.
-
-
-
-
- Indicates whether the current object is equal to another object of the same type.
-
- An object to compare with this object.
-
- if represents the same request with the
- same requested count; otherwise, .
-
-
-
-
- Unwraps a request for many instances and returns the results.
-
-
-
-
- Creates many specimen based on a request.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- Many specimens if is a
- instance; otherwise a instance.
-
-
-
-
- Represents a request for many (an unspecified number) of specimens.
-
-
-
- The difference between and
- is that the latter specifies the number of specimens
- requested.
-
-
- translates instances to
- instances.
-
-
-
-
-
-
-
- Initializes a new instance of the class.
-
- A single request which will be multiplied.
-
-
-
- Determines whether the specified is equal to this instance.
-
-
- The to compare with this instance.
-
-
- if is a
- instance which is equal to this instance; otherwise, .
-
-
-
-
- Returns a hash code for this instance.
-
-
- A hash code for this instance, suitable for use in hashing algorithms and data
- structures like a hash table.
-
-
-
-
- Indicates whether the current is equal to another
- MultipleRequest instance.
-
- An object to compare with this object.
-
- if the current is equal to the
- parameter; otherwise, false.
-
-
-
-
- Gets the request to multiply.
-
-
-
-
- Relays requests for multiple (an unspecified count) specimens to a request for a specific
- number of specimens.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates many new specimens based on a request.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The requested specimens if possible; otherwise a instance.
-
-
-
- The number of specimens requested is determined by .
-
-
-
-
-
- Gets or sets the count that specifies how many specimens will be requested.
-
-
-
-
- Provides custom equality comparison for instances.
-
-
-
-
- Determines whether the specified objects are equal.
-
- The first object of type to compare.
- The second object of type to compare.
-
- if the specified objects are considered equal; otherwise,
- .
-
-
-
- and are considered equal if x is exactly
- equal to y. If not, they are still considered equal if both instances'
- and properties are
- equal.
-
-
-
-
-
- Returns a hash code for a instance.
-
- The object.
-
- A hash code for the supplied instance, suitable for use in hashing algorithms and data
- structures like a hash table.
-
-
- The type of is a reference type and is
- null.
-
-
-
-
- Selects public constructors ordered by the most modest constructor first.
-
-
-
-
- Selects the constructors for the supplied type.
-
- The type.
-
- All public constructors for , ordered by the most modest
- constructor first.
-
-
-
- The ordering of the returned constructors is based on the number of parameters of the
- constructor. Constructors with fewer parameters are returned before constructors with
- more parameters. This means that if a default constructor exists, it will be the first
- one returned.
-
-
- In case of two constructors with an equal number of parameters, the ordering is
- unspecified.
-
-
-
-
-
- Prevents a decorated from returning a
- instance.
-
-
-
-
- Initializes a new instance of the class with an
- to decorate.
-
- The builder to decorate.
-
-
-
- Initializes a new instance of the class with an
- to decorate and an
- that is used to determine whether an exception should be thrown based on the request.
-
- The builder to decorate.
- The specification.
-
-
-
- Creates a new specimen by delegating to the decorated .
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The requested specimen if possible; otherwise an exception is thrown or a
- instance is returned.
-
-
- The decorated returned a result and
- returned for
- .
-
-
-
-
- Gets the decorated builder.
-
- The supplied via the constructor.
-
-
-
-
-
- Gets the specification that is used to determine whether an exception should be thrown
- for a request that returns a instance.
-
- The supplied via the constructor.
-
-
-
-
-
- Decorates a with a .
-
-
-
-
- Decorates the supplied with a
- .
-
- The builder to decorate.
-
- decorated with a .
-
-
-
-
- A specification that evaluates seeded requests for types against a target type.
-
-
-
-
- Initializes a new instance of the class.
-
- The target type.
-
-
-
- Evaluates a request for a specimen.
-
- The specimen request.
-
- if is a
- for a type that matches ; otherwise, .
-
-
-
-
- Gets the type targeted by this .
-
-
-
-
- A no-op that identifies a certain property or field.
-
- The type of specimen.
- The type of property or field.
-
-
- This class can be used to reserve an identified property or field without doing anything
- with it.
-
-
-
-
-
- Initializes a new instance of the
- class with the supplied
- property picker expression.
-
- An expression that identifies a property or field.
-
-
-
- Does nothing.
-
- A specimen.
- An .
-
-
-
- Evaluates whether a request matches the property or field reserved by this command.
-
- The specimen request.
-
- if is is a
- or that identifies the property or field reserved by this
- ; otherwise, .
-
-
-
-
- Gets the member identified by the expression supplied through the constructor.
-
-
-
-
- A boolean 'Or' Composite .
-
-
-
-
- Initializes a new instance of the class with the
- supplied specifications.
-
- An array of .
-
-
-
- Initializes a new instance of the class with the
- supplied specifications.
-
- A sequence of .
-
-
-
- Evaluates a request for a specimen.
-
- The specimen request.
-
- if is satisfied by any of the
- ; otherwise, .
-
-
-
-
- Gets the decorated specifications.
-
-
-
-
- Performs post-processing on a created specimen.
-
-
-
-
- Performs post-processing on a created specimen.
-
- The type of specimen.
-
-
-
- Initializes a new instance of the class with the
- supplied parameters.
-
- The to decorate.
- The action to perform on the created specimen.
-
-
-
- Initializes a new instance of the class with the
- supplied parameters.
-
- The to decorate.
- The action to perform on the created specimen.
-
-
-
- Initializes a new instance of the class with the
- supplied parameters.
-
- The to decorate.
- The action to perform on the created specimen.
-
- A specification which is used to determine whether postprocessing should be performed
- for a request.
-
-
-
-
- Creates a new specimen based on a request and performs an action on the created
- specimen.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The requested specimen if possible; otherwise a instance.
-
-
-
- The can be any object, but will often be a
- or other instances.
-
-
-
-
-
- Gets the action to perform on created specimens.
-
-
-
-
- Gets the decorated builder.
-
-
-
-
- Gets the filter that determines whether should be executed.
-
-
-
-
- Initializes a new instance of the class with the supplied
- parameters.
-
- The to decorate.
- The action to perform on the created specimen.
-
-
-
- Initializes a new instance of the class with the supplied
- parameters.
-
- The to decorate.
- The action to perform on the created specimen.
-
-
-
- Initializes a new instance of the class with the supplied
- parameters.
-
- The to decorate.
- The action to perform on the created specimen.
-
- A specification which is used to determine whether postprocessing should be performed
- for a request.
-
-
-
-
- Encapsulates a command that binds a property or a field to a value.
-
-
- The type of the specimn on which the property or value will be set.
-
- The type of property or field.
-
-
-
- Initializes a new instance of the class with
- the supplied property picker expression.
-
- An expression that identifies a property or field.
-
-
- This constructor implies that an anonymous value will be assigned to the property or
- field identified by .
-
-
-
-
-
- Initializes a new instance of the class with
- the supplied property picker expression and the value to be assigned to that property
- or field.
-
- An expression that identifies a property or field.
-
- The value to assign to the property or field identified by
- .
-
-
-
-
- Initializes a new instance of the class with
- the supplied property picker expression and a function that creates a value to be
- assigned to that property or field.
-
- An expression that identifies a property or field.
-
- A function that creates a value that will be assigned to the property or field
- identified by .
-
-
-
-
- Executes the command on the supplied specimen by assigning the property of field the
- correct value.
-
-
- A specimen that should have its property or field assigned.
-
-
- An which can supply an anonymous value for the
- property or field.
-
-
-
- This method assigns a value to the property or field identified by the expression
- supplied to the class' constructor. If no value (or creator) was supplied to the
- constructor, will be used to create the value.
-
-
-
-
-
- Evaluates whether a request matches the property or field affected by this command.
-
- The specimen request.
-
- if is a
- or that identifies the property or field affected by this
- ; otherwise, .
-
-
-
-
- Gets the member identified by the expression supplied through the constructor.
-
-
-
-
- Gets the function that creates a value to be assigned to the property or field
- identified by .
-
-
-
-
- Relays a request for a property to a with a seed based
- on the property's name.
-
-
-
-
- Creates a specimen based on a requested property.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- A specimen created from a encapsulating the property type
- and name of the requested property, if possible; otherwise, a
- instance.
-
-
-
-
- Creates a new specimen from a using a function.
-
- The type of specimen to create.
-
-
-
- Initializes a new instance of the class.
-
- The function that will create the specimen from a seed.
-
-
-
- Creates a new specimen based on a seeded request.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The result of the contained function if is a
- for the correct type and containing a seed of the same
- type; otherwise a instance.
-
-
-
-
- Gets the factory that is used to create specimens from a seed.
-
-
-
-
- Creates a new specimen using a .
-
- The type of specimen to create.
-
-
-
- Initializes a new instance of the class.
-
- The func that will create specimens.
-
-
-
- Creates a new specimen based on a request.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The specimen created by the Func contained by this instance.
-
-
-
- is ignored. Instead, the Func contained by this instance is
- used to create a specimen.
-
-
-
-
-
- Gets the factory that will create specimens.
-
-
-
-
- Creates a new specimen using a .
-
- The type of the parameter provided to the Func.
- The type of specimen to create.
-
-
-
- Initializes a new instance of the class.
-
- The func that will create specimens.
-
-
- The input parameter to will be supplied by the
- passed to the method.
-
-
-
-
-
- Creates a new specimen based on a request.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The specimen created by the Func contained by this instance.
-
-
-
- is ignored. Instead, the Func contained by this instance is
- used to create a specimen. The parameter for the Func is supplied by
- .
-
-
-
-
-
- Gets the factory that creates specimens.
-
-
-
-
- Creates a new specimen using a .
-
- The type of the first parameter provided to the Func.
- The type of the second parameter provided to the Func.
- The type of specimen to create.
-
-
-
- Initializes a new instance of the
- class.
-
- The func that will create specimens.
-
-
- The input parameters to will be supplied by the
- passed to the method.
-
-
-
-
-
- Creates a new specimen based on a request.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The specimen created by the Func contained by this instance.
-
-
-
- is ignored. Instead, the Func contained by this instance is
- used to create a specimen. The parameters for the Func is supplied by
- .
-
-
-
-
-
- Gets the factory that creates specimens.
-
-
-
-
- Creates a new specimen using a .
-
- The type of the first parameter provided to the Func.
- The type of the second parameter provided to the Func.
- The type of the third parameter provided to the Func.
- The type of specimen to create.
-
-
-
- Initializes a new instance of the
- class.
-
- The func that will create specimens.
-
-
- The input parameters to will be supplied by the
- passed to the method.
-
-
-
-
-
- Creates a new specimen based on a request.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The specimen created by the Func contained by this instance.
-
-
-
- is ignored. Instead, the Func contained by this instance is
- used to create a specimen. The parameters for the Func is supplied by
- .
-
-
-
-
-
- Gets the factory that creates specimens.
-
-
-
-
- Creates a new specimen using a .
-
- The type of the first parameter provided to the Func.
- The type of the second parameter provided to the Func.
- The type of the third parameter provided to the Func.
- The type of the fourth parameter provided to the Func.
- The type of specimen to create.
-
-
-
- Initializes a new instance of the
- class.
-
- The func that will create specimens.
-
-
- The input parameters to will be supplied by the
- passed to the method.
-
-
-
-
-
- Creates a new specimen based on a request.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The specimen created by the Func contained by this instance.
-
-
-
- is ignored. Instead, the Func contained by this instance is
- used to create a specimen. The parameters for the Func is supplied by
- .
-
-
-
-
-
- Gets the factory that creates specimens.
-
-
-
-
- Throws an .
-
-
-
- This can be used as the last item in a
- to throw an exception instead of letting the
- containing builder return a instance when it can't satisfy a
- request.
-
-
-
-
-
- Throws an .
-
- The request that describes what to create.
-
- A context that can be used to create other specimens. Not used.
-
-
- This method never returns. It always throws an .
-
-
-
-
- Decorates a with a .
-
-
-
-
- Decorates the supplied with a
- .
-
- The builder to decorate.
-
- decorated with a .
-
-
-
-
- Trace writer that will write out a trace of object requests and created objects
- in the pipeline.
-
-
-
-
- Initializes a new instance of the class.
-
- The output stream for the trace.
- The to decorate.
-
-
-
- Creates a new specimen based on a request by delegating to its decorated builder.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The requested specimen if possible; otherwise a instance.
-
-
-
-
- Gets the decorated by this instance.
-
-
-
-
- Gets or sets the formatter for tracing a request.
-
- The request trace formatter.
-
-
-
- Gets or sets the formatter for tracing a created specimen.
-
- The created specimen trace formatter.
-
-
-
- Creates new instances.
-
-
-
-
- Creates a new instance.
-
- A new instance.
-
-
-
- Creates a new instance.
-
- The request that describes what to create.
- Not used.
-
- A new instance, if is a request for a
- ; otherwise, a instance.
-
-
-
-
- Creates specimens by returning the first specimen created by its children.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with the
- supplied builders.
-
- The child builders.
-
-
-
- Initializes a new instance of the class with the
- supplied builders.
-
- The child builders.
-
-
-
- Createa a new specimen by delegating to .
-
- The request that describes what to create.
- A container that can be used to create other specimens.
- The first result created by .
-
-
-
- Gets the child builders.
-
-
-
-
- Default implementation of .
-
-
-
-
- A context used to create anonymous variables (specimens).
-
-
-
-
- Creates an anonymous variable (specimen) based on a request.
-
- The request that describes what to create.
- The requested specimen if possible.
-
-
- The can be any object, but will often be a
- or other instances.
-
-
-
-
-
- Initializes a new instance of with the supplied
- .
-
- The builder that will handle requests.
-
-
-
- Creates an anonymous variable (specimen) based on a request by delegating the request
- to its contained .
-
- The request that describes what to create.
- The result of a request to the contained .
-
-
-
- Gets the contained by the instance.
-
-
-
-
- Creates a new instance of the requested type by invoking the first constructor it can
- satisfy.
-
-
-
-
- Initializes a new instance of the class with the
- supplied .
-
-
- The that defines which constructors are attempted.
-
-
-
-
- Creates a specimen of the requested type by invoking the first constructor it can
- satisfy.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- A specimen generated from a constructor of the requested type, if possible;
- otherwise, .
-
-
-
- This method uses the first constructor returned by where
- can create values for all parameters.
-
-
-
-
-
- Gets the that defines which constructors will be
- attempted.
-
-
-
-
- Signifies that it's not a specimen.
-
-
-
- implementations are expected to return
- instances if they can't handle the request. This ensures that
- can be used as a proper return value.
-
-
-
-
-
- Initializes a new instance of the class with a null request.
-
-
-
-
- Initializes a new instance of the class with the supplied
- request.
-
-
- The original request that prompts the creation of this instance.
-
-
-
-
- Determines whether the specified is equal to the current
- instance.
-
- The to compare to the current instance.
-
- if the specified is equal to the current
- instance; otherwise, .
-
-
-
-
- Serves as a hash function for the class.
-
- A hash code for the current instance.
-
-
-
- Indicates whether the current instance is equal to another
- instance.
-
-
- A instance to compare with this instance.
-
-
- if the current instanec is equal to the
- parameter; otherwise, .
-
-
-
-
- Gets the original request that prompted the creation of the current instance.
-
-
-
- This property value may be .
-
-
-
-
-
- Relays a request for a parameter to a with a seed based
- on the parameter's name.
-
-
-
-
- Creates a specimen based on a requested parameter.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- A specimen created from a encapsulating the parameter type
- and name of the requested parameter, if possible; otherwise, a
- instance.
-
-
-
-
- Tracks any request and passes it on to the container.
- Tracks any returned object from the container and passes it on.
-
-
-
-
- Initializes a new instance of the class with a decorated
- .
-
- The to decorate.
-
-
-
- Creates a new specimen based on a request and raises events tracing the progress.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- The requested specimen if possible; otherwise a instance.
-
-
-
- The can be any object, but will often be a
- or other instances.
-
-
-
-
-
- Raises the event.
-
- The event arguments for the event.
-
-
-
- Raises the event.
-
- The event arguments for the event.
-
-
-
- Raised when a specimen is requested.
-
-
-
-
- Raised when a specimen was created.
-
-
-
-
- Gets the builder decorated by this instance.
-
-
-
-
- Gets or sets a filter for tracking
-
-
-
- By default, tracks all requests and created Specimens, but you can
- provide a custom filter to only allow certain requests to be traced.
-
-
- As this is a variation of the Specification pattern, the filter must return
- to allow the request to be tracked.
-
-
-
-
-
- Event arguments about a created specimen.
-
-
-
-
- Event args about a request for a specimen
-
-
-
-
- Initializes a new instance of the class with the
- supplied values.
-
- A request for a specimen
-
- The recursion depth at which occurred.
-
-
-
-
- Gets the recursion depth at which occurred.
-
-
-
-
- Gets the original request for a speciman
-
-
-
-
- Initializes a new instance of the class with the
- supplied values.
-
- A request for a specimen
-
- The specimen that was created base on .
-
-
- The recursion depth at which occurred.
-
-
-
-
- Gets the specimen that was created from .
-
-
-
-
- Unwraps a request for a string to a request for a string and
- prefixes the seed to the result.
-
-
-
-
- Creates an anonymous string based on a seed.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- A string with the seed prefixed to a string created by if
- possible; otherwise, .
-
-
-
- This method only returns an instance if a number of conditions are satisfied.
- must represent a request for a seed string, and
- must be able to create a string.
-
-
-
-
-
- A that is always .
-
-
-
-
- Evaluates a request for a specimen.
-
- The specimen request.
-
- .
-
-
-
-
- A specification that evaluates requests for types against a target type.
-
-
-
-
- Initializes a new instance of the class.
-
- The target type.
-
-
-
- Evaluates a request for a specimen.
-
- The specimen request.
-
- if matches the target type;
- otherwise, .
-
-
-
-
- Gets the type targeted by this .
-
-
-
-
- Encapsulates an operation without identifying any property or field.
-
- The type of specimen.
-
-
-
- Initializes a new instance of the
- class.
-
- The action to perform on a specimen.
-
-
-
- Executes on the supplied specimen.
-
- The specimen on which the command is executed.
-
- An that can be used to resolve other requests. Not
- used.
-
-
-
-
- Evaluates a request for a specimen.
-
- The specimen request.
-
- .
-
-
-
-
- Gets the action that can be performed on a specimen.
-
-
-
-
- Unwraps a request for a to a request for its
- while ignoring the .
-
-
-
-
- Creates an anonymous value by unwrapping a seeded request and ignoring the seed.
-
- The request that describes what to create.
- A context that can be used to create other specimens.
-
- A specimen based on if possible; otherwise,
- .
-
-
-
- If is a seeded request, the Create method unwraps the inner
- request and forwards it to . The seed value is ignored.
-
-
- The purpose of this class is to provide a fallback to handle seeded requests that no
- other instances have been able to handle. By ignoring
- the seed value, it handles those scenarios where the seed value and the inner request
- don't match and can't be combined, ensuring that at least some value is returned.
-
-
-
-
-
- Creates an alternating sequence of and ,
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Returns an alternating sequence of and
- every other time it is invoked.
-
-
- , followed by at the next invocation, and
- so on.
-
-
-
-
- Returns an alternating sequence of and
- every other time it is invoked.
-
- The request that describes what to create.
- Not used.
-
- , followed by at the next invocation, and
- so on, if is a request for a boolean; otherwise, a
- instance.
-
-
-
-
- Creates a sequence of consecutive numbers, starting at 1.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates an anonymous number.
-
- The next number in a consequtive sequence.
-
-
-
- Creates an anonymous byte.
-
- The request that describes what to create.
- Not used.
-
- The next byte in a consequtive sequence, if is a request
- for a byte; otherwise, a instance.
-
-
-
-
- Creates a sequence of consecutive numbers, starting at 1.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates an anonymous number.
-
- The next number in a consequtive sequence.
-
-
-
- Creates an anonymous number.
-
- The request that describes what to create.
- Not used.
-
- The next number in a consequtive sequence, if is a request
- for a decimal number; otherwise, a instance.
-
-
-
-
- Creates a sequence of consecutive numbers, starting at 1.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates an anonymous number.
-
- The next number in a consequtive sequence.
-
-
-
- Creates an anonymous number.
-
- The request that describes what to create.
- Not used.
-
- The next number in a consequtive sequence, if is a request
- for a ; otherwise, a instance.
-
-
-
-
- Provides anonymous object creation services.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Initializes a new instance of the class with the supplied engine
- parts.
-
- The engine parts.
-
-
-
- Initializes a new instance of the class with the supplied engine
- and a definition of what 'many' means.
-
- The engine.
- The definition and implementation of 'many'.
-
-
-
- Customizes the creation algorithm for a single object.
-
-
- The type of object for which the algorithm should be customized.
-
-
- A that can be used to customize the creation
- algorithm before creating the object.
-
-
-
-
- Applies a customization.
-
- The customization to apply.
-
- The current instance.
-
-
-
-
- Customizes the creation algorithm for all objects of a given type.
-
- The type of object to customize.
-
- A function that customizes a given and returns
- the modified composer.
-
-
-
- The resulting is added to .
-
-
-
-
-
- Registers a specific instance for a specific type.
-
-
- The type for which should be registered.
-
- The item to register.
-
-
- This method is deprecated. Use
- instead.
-
-
-
-
-
-
- Repeats a function many times.
-
-
- The type of object that creates.
-
-
- A function that creates an instance of .
-
- A sequence of objects created by .
-
-
- The number of times is invoked is determined by
- .
-
-
-
-
-
- Composes a new instance that contains all the relevant
- strategies defined for this instance.
-
-
- A new instance that contains all the relevant strategies
- for the this instance, including ,
- and .
-
-
-
-
- Gets the behaviors that are applied when is invoked.
-
-
-
-
- Gets the customizations that intercept the .
-
-
-
- Any in this list are invoked before
- , giving them a chance to intercept a request and resolve it before
- the Engine.
-
-
- places resulting customizations in this list.
-
-
-
-
-
-
-
- Gets the core engine of the instance.
-
-
-
- This is the core engine that drives a instance. Even with no
- or , the
- should be capably of resolving a wide range of different requests,
- based on conventions.
-
-
-
-
-
-
-
- Gets or sets if writable properties should generally be assigned a value when
- generating an anonymous object.
-
-
-
- The default value is false.
-
-
-
-
-
- Gets or sets a number that controls how many objects are created when a
- creates more than one anonymous objects.
-
-
-
- The default value is 3.
-
-
-
-
-
-
-
-
-
-
- Gets the residue collectors that can be used to handle requests that neither the
- nor could handle.
-
-
-
- These instances will be invoked if no previous builder
- could resolve a request. This gives you the opportunity to define fallback strategies
- to deal with unresolved requests.
-
-
-
-
-
- Creates a sequence of consecutive numbers, starting at 1.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates an anonymous number.
-
- The next number in a consequtive sequence.
-
-
-
- Creates an anonymous number.
-
- The request that describes what to create.
- Not used.
-
- The next number in a consequtive sequence, if is a request
- for a 16-bit integer; otherwise, a instance.
-
-
-
-
- Creates a sequence of consecutive numbers, starting at 1.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates an anonymous number.
-
- The next number in a consequtive sequence.
-
-
-
- Creates an anonymous number.
-
- The request that describes what to create.
- Not used.
-
- The next number in a consequtive sequence, if is a request
- for an integer; otherwise, a instance.
-
-
-
-
- Creates a sequence of consecutive numbers, starting at 1.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates an anonymous number.
-
- The next number in a consequtive sequence.
-
-
-
- Creates an anonymous number.
-
- The request that describes what to create.
- Not used.
-
- The next number in a consequtive sequence, if is a request
- for an 64-bit integer; otherwise, a instance.
-
-
-
-
- Recursion handler that returns null at recursion points.
-
-
-
-
- Base class for recursion handling. Tracks requests and reacts when a recursion point in the
- specimen creation process is detected.
-
-
-
-
- Initializes a new instance of the class.
-
- The intercepting builder to decorate.
-
-
-
- Initializes a new instance of the class.
-
- The intercepting builder to decorate.
-
- An IEqualitycomparer implementation to use when comparing requests to determine recursion.
-
-
-
-
- Handles a request that would cause recursion.
-
- The recursion causing request.
- The specimen to return.
-
-
-
- Creates a new specimen based on a request.
-
- The request that describes what to create.
- A container that can be used to create other specimens.
-
- The requested specimen if possible; otherwise a instance.
-
-
-
- The can be any object, but will often be a
- or other instances.
-
-
-
-
-
- Gets the decorated builder supplied via the constructor.
-
-
-
-
-
-
- Gets the recorded requests so far.
-
-
-
-
- Initializes a new instance of the class.
-
- The builder to decorate.
-
-
-
- Initializes a new instance of the class.
-
- The intercepting builder to decorate.
- An IEqualitycomparer implementation to use when comparing requests to determine recursion.
-
-
-
- Handles a request that would cause recursion by returning null.
-
- The recursion causing request.
- Always null.
-
-
-
- The exception that is thrown when AutoFixture is unable to create an object.
-
-
-
-
- Initializes a new instance of the class with a
- default .
-
-
-
-
- Initializes a new instance of the class with a
- custom .
-
-
- The error message that explains the reason for the exception.
-
-
-
-
- Initializes a new instance of the class with a
- custom and .
-
-
- The error message that explains the reason for the exception.
-
-
- The exception that is the cause of the current exception.
-
-
-
-
- Ininitalizes a new instance of the class with
- serialized data.
-
- The object that holds the serialized object data.
-
- The contextual information about the source or destination.
-
-
-
-
- Creates a sequence of consecutive numbers, starting at 1.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates an anonymous number.
-
- The next number in a consequtive sequence.
-
-
-
- Creates an anonymous .
-
- The request that describes what to create.
- Not used.
-
- The next in a consequtive sequence, if
- is a request for an SByte; otherwise, a instance.
-
-
-
-
- Encapsulates a seed for a given type.
-
-
-
-
- Initializes a new instance of the class.
-
- The request for which the seed applies.
- The seed.
-
-
-
- Determines whether this instance equals another instance.
-
- The other instance.
-
- if this instance equals ; otherwise,
- .
-
-
-
-
- Returns the hash code for the instance.
-
- The hash code for the instance.
-
-
-
- Determines whether this instance equals another instance.
-
- The other instance.
-
- if this instance equals ; otherwise,
- .
-
-
-
-
- Gets the seed value.
-
-
-
-
- Gets the inner request for which the seed applies.
-
-
-
-
- Creates a sequence of consecutive numbers, starting at 1.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates an anonymous number.
-
- The next number in a consequtive sequence.
-
-
-
- Creates an anonymous number.
-
- The request that describes what to create.
- Not used.
-
- The next number in a consequtive sequence, if is a request
- for a ; otherwise, a instance.
-
-
-
-
- Provides an API to customize the creational strategy for a specific type.
-
-
-
-
- Invokes the supplied action with an anonymous parameter value.
-
- The type of the anonymous parameter.
- The composer.
- The action to invoke.
-
-
-
- Invokes the supplied action with anonymous parameter values.
-
- The type of the first anonymous parameter.
- The type of the second anonymous parameter.
- The composer.
- The action to invoke.
-
-
-
- Invokes the supplied action with anonymous parameter values.
-
- The type of the first anonymous parameter.
- The type of the second anonymous parameter.
- The type of the third anonymous parameter.
- The composer.
- The action to invoke.
-
-
-
- Invokes the supplied action with anonymous parameter values.
-
- The type of the first anonymous parameter.
- The type of the second anonymous parameter.
- The type of the third anonymous parameter.
- The type of the fourth anonymous parameter.
- The composer.
- The action to invoke.
-
-
-
- Invokes the supplied function with an anonymous parameter value and returns the result.
-
- The type of the anonymous parameter.
- The return type.
- The composer.
- The function to invoke.
- The return value of .
-
-
-
- Invokes the supplied function with anonymous parameter values and returns the result.
-
- The type of the first anonymous parameter.
- The type of the second anonymous parameter.
- The return type.
- The composer.
- The function to invoke.
- The return value of .
-
-
-
- Invokes the supplied function with anonymous parameter values and returns the result.
-
- The type of the first anonymous parameter.
- The type of the second anonymous parameter.
- The type of the third anonymous parameter.
- The return type.
- The composer.
- The function to invoke.
- The return value of .
-
-
-
- Invokes the supplied function with anonymous parameter values and returns the result.
-
- The type of the first anonymous parameter.
- The type of the second anonymous parameter.
- The type of the third anonymous parameter.
- The type of the fourth anonymous parameter.
- The return type.
- The composer.
- The function to invoke.
- The return value of .
-
-
-
- Creates anonymous variables from or
- instances.
-
-
-
-
- Creates an anonymous variable of the requested type.
-
- The type of object to create.
- The context used to resolve the type request.
- An anonymous object of type .
-
-
-
- Creates an anonymous variable of the requested type.
-
- The type of object to create.
- The composer used to resolve the type request.
- An anonymous object of type .
-
-
-
- Creates an anonymous variable of the requested type.
-
- The type of object to create.
- The composer used to resolve the type request.
- An anonymous object of type .
-
-
- The only purpose of this explicit overload is to support type inferencing.
-
-
-
-
-
- Creates an anonymous object, potentially using the supplied seed as additional
- information when creating the object.
-
- The type of object to create.
-
- Any data that adds additional information when creating the anonymous object.
-
- The context used to resolve the type request.
- An anonymous object.
-
-
-
- Creates an anonymous object, potentially using the supplied seed as additional
- information when creating the object.
-
- The type of object to create.
-
- Any data that adds additional information when creating the anonymous object.
-
- The composer used to resolve the type request.
- An anonymous object.
-
-
-
- Creates many anonymous objects.
-
- The type of objects to create.
- The context used to resolve the type request.
- A sequence of anonymous object of type .
-
-
-
- Creates many anonymous objects.
-
- The type of objects to create.
- The composer used to resolve the type request.
- A sequence of anonymous object of type .
-
-
-
- Creates many anonymous objects.
-
- The type of objects to create.
- The composer used to resolve the type request.
- A sequence of anonymous object of type .
-
-
- The only purpose of this explicit overload is to support type inferencing.
-
-
-
-
-
- Creates many anonymous objects.
-
- The type of objects to create.
- The context used to resolve the type request.
-
- An initial value that may or may not be used as input for the algorithm creating the
- return value.
-
- A sequence of anonymous object of type .
-
-
-
- Creates many anonymous objects.
-
- The type of objects to create.
- The composer used to resolve the type request.
-
- An initial value that may or may not be used as input for the algorithm creating the
- return value.
-
- A sequence of anonymous object of type .
-
-
-
- Creates many anonymous objects.
-
- The type of objects to create.
- The context used to resolve the type request.
- The number of objects to create.
- A sequence of anonymous objects of type .
-
-
-
- Creates many anonymous objects.
-
- The type of objects to create.
- The composer used to resolve the type request.
- The number of objects to create.
- A sequence of anonymous objects of type .
-
-
-
- Creates many anonymous objects.
-
- The type of objects to create.
- The composer used to resolve the type request.
- The number of objects to create.
- A sequence of anonymous objects of type .
-
-
- The only purpose of this explicit overload is to support type inferencing.
-
-
-
-
-
- Creates many anonymous objects.
-
- The type of objects to create.
- The context used to resolve the type request.
-
- An initial value that may or may not be used as input for the algorithm creating the
- return value.
-
- The number of objects to create.
- A sequence of anonymous objects of type .
-
-
-
- Creates many anonymous objects.
-
- The type of objects to create.
- The composer used to resolve the type request.
-
- An initial value that may or may not be used as input for the algorithm creating the
- return value.
-
- The number of objects to create.
- A sequence of anonymous objects of type .
-
-
-
- Creates string values based on a supplied factory.
-
-
-
-
- Initializes a new instance of the class with the supplied
- specimen factory.
-
-
- A factory that creates a anonymous variables (specimens). The
- instance will call on the
- created specimen.
-
-
-
-
- Creates string specimens by invoking the supplied specimen factory and calling
- on the result.
-
- The request that describes what to create.
- Not used.
-
- The string representation of a specimen created by the contained specimen factory.
-
-
-
-
- Gets the factory used to specimens.
-
-
-
-
-
- Handles recursion in the specimen creation process by throwing an exception at recursion point.
-
-
-
-
- Initializes a new instance of the class.
-
- The intercepting builder to decorate.
- An IEqualitycomparer implementation to use when comparing requests to determine recursion.
-
-
-
- Initializes a new instance of the class.
-
- The builder.
-
-
-
- Handles a request that would cause recursion by throwing an exception.
-
- The recursion causing request.
- Nothing. Always throws.
-
-
-
- Decorates an with a to enable
- tracing for diagnosing how the decorated builder builds up specimens.
-
-
-
-
- Initializes a new instance of the class with the default
- , which is .
-
-
-
-
- Initializes a new instance of the class with the supplied
- .
-
- The writer to which diagnostics is written.
-
-
-
- Decorates the supplied builder with a .
-
- The builder to transform.
-
- A new that decorates using
- .
-
-
-
-
- Gets the writer to which diagnostics information is written.
-
-
-
-
- Creates a sequence of consecutive numbers, starting at 1.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates an anonymous number.
-
- The next number in a consequtive sequence.
-
-
-
- Creates an anonymous number.
-
- The request that describes what to create.
- Not used.
-
- The next number in a consequtive sequence, if is a request
- for an unsigned 16-bit integer; otherwise, a instance.
-
-
-
-
- Creates a sequence of consecutive numbers, starting at 1.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates an anonymous number.
-
- The next number in a consequtive sequence.
-
-
-
- Creates an anonymous number.
-
- The request that describes what to create.
- Not used.
-
- The next number in a consequtive sequence, if is a request
- for an unsigned integer; otherwise, a instance.
-
-
-
-
- Creates a sequence of consecutive numbers, starting at 1.
-
-
-
-
- Initializes a new instance of the class.
-
-
-
-
- Creates an anonymous number.
-
- The next number in a consequtive sequence.
-
-
-
- Creates an anonymous number.
-
- The request that describes what to create.
- Not used.
-
- The next number in a consequtive sequence, if is a request
- for an unsigned 64-bit integer; otherwise, a instance.
-
-
-
-
diff --git a/Lib/RestSharp.MonoTouch.dll b/Lib/RestSharp.MonoTouch.dll
deleted file mode 100755
index ef5eddf..0000000
Binary files a/Lib/RestSharp.MonoTouch.dll and /dev/null differ
diff --git a/Lib/RestSharp.WindowsPhone.dll b/Lib/RestSharp.WindowsPhone.dll
deleted file mode 100644
index 69304fe..0000000
Binary files a/Lib/RestSharp.WindowsPhone.dll and /dev/null differ
diff --git a/Lib/RestSharp.dll b/Lib/RestSharp.dll
deleted file mode 100644
index 76ed2a9..0000000
Binary files a/Lib/RestSharp.dll and /dev/null differ
diff --git a/Lib/RestSharp.old.dll b/Lib/RestSharp.old.dll
deleted file mode 100644
index f34b816..0000000
Binary files a/Lib/RestSharp.old.dll and /dev/null differ
diff --git a/Lib/sl4-wp71/System.Threading.Tasks.WP71.dll b/Lib/sl4-wp71/System.Threading.Tasks.WP71.dll
new file mode 100644
index 0000000..0fc0566
Binary files /dev/null and b/Lib/sl4-wp71/System.Threading.Tasks.WP71.dll differ
diff --git a/README.markdown b/README.markdown
index bc9d19c..8971fec 100644
--- a/README.markdown
+++ b/README.markdown
@@ -1,13 +1,86 @@
-.NET Client library for the Dropbox API
+### Note: Development of DropNet has stopped!
+DropNet is no longer under development and the current version of the library does not work with Dropbox API v2. I recommend moving to the official Dropbox .net SDK - https://github.com/dropbox/dropbox-sdk-dotnet
-http://dkdevelopment.net/ //TODO - Update
-Example usage:
- var dropNetclient = new DropNetClient("API_KEY", "API_SECRET");
+---
+
+
+
+## .NET Client library for the Dropbox API
+
+[](https://ci.appveyor.com/project/dkarzon/dropnet/branch/master)
+
+Full documentation here: http://dropnet.github.io/dropnet.html
+
+## How do I use it?
+
+##### The Client:
+To use DropNet you need an instance of the DropNetClient class, this class does everything for DropNet. This class takes the API Key and API Secret (These must be obtained from Dropbox to access the API).
+
+```csharp
+ _client = new DropNetClient("API KEY", "API SECRET");
+```
- //call the functions you want from the client
- dropNetclient.Login("test@example.com", "password");
- var rootDetails = dropNetclient.GetMetaData();
- //rootDetails.Contents is a list of the files/folders in the root
\ No newline at end of file
+##### Login/Tokens:
+Dropbox now requires a web authentication to get a usable token/secret, so this is a 3 step process.
+
+**Step 1.** Get Request Token - This step gets an oauth token from dropbox (NOTE: the token must pass the other steps before it can be used)
+
+```csharp
+ // Sync
+ _client.GetToken();
+
+ // Async
+ _client.GetTokenAsync((userLogin) =>
+ {
+ //Dont really need to do anything with userLogin, DropNet takes care of it for now
+ },
+ (error) =>
+ {
+ //Handle error
+ });
+```
+
+**Step 2.** Authorize App with Dropbox - This step involves sending the user to a login page on the dropbox site and having them authenticate there. The DropNet client has a function to return the url for you but the rest must be handled in app, this function also takes a callback url for redirecting the user to after they have logged in. (NOTE: The token still cant be used yet.)
+
+```csharp
+ var url = _client.BuildAuthorizeUrl();
+ //Use the url in a browser so the user can login
+```
+
+Open a browser with the url returned by BuildAuthorizeUrl - After we have the authorize url we need to direct the user there (use some sort of browser here depending on the platform) and navigate the user to the url. This will prompt them to login and authorize your app with the API.
+
+**Step 3.** Get an Access Token from the Request Token - This is the last stage of the process, converting the oauth request token into a usable dropbox API token. This function will use the clients stored Request Token but this can be overloaded if you need to specify a token to use.
+
+```csharp
+ // Sync
+ var accessToken = _client.GetAccessToken(); //Store this token for "remember me" function
+
+ // Async
+ _client.GetAccessTokenAsync((accessToken) =>
+ {
+ //Store this token for "remember me" function
+ },
+ (error) =>
+ {
+ //Handle error
+ });
+```
+
+
+
+**Best Practices:** Dropbox's Developer page states several times in bold red font that applications should not store a users Dropbox password and to help enforce this DropNet allows you to manually set a users Token and Secret on the client.
+
+```csharp
+ _client = new DropNetClient("API KEY", "API SECRET", "USER TOKEN", "USER SECRET");
+ // OR
+ _client = new DropNetClient("API KEY", "API SECRET");
+ _client.UserLogin = new UserLogin { Token = "USER TOKEN", Secret = "USER SECRET" };
+```
+
+***
+
+Questions? http://stackoverflow.com/questions/tagged/dropnet
+
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..75afa2e
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,19 @@
+version: 1.10.{build}
+
+configuration: Release
+test: off
+build:
+ project: DropNet.sln
+ publish_nuget: true
+ publish_nuget_symbols: true
+
+assembly_info:
+ patch: true
+ file: AssemblyInfo.*
+ assembly_version: "{version}"
+ assembly_file_version: "{version}"
+ assembly_informational_version: "{version}"
+
+
+# scripts to run before build
+before_build: nuget restore
\ No newline at end of file