public DocumentationTests() { var processes = System.Diagnostics.Process.GetProcessesByName("Moksy.Host"); Assert.AreEqual(1, processes.Length, "Moksy.Host is not running. Right click the Moksy.Host project, add 10011 to the Debug / Command Line Arguments and then run Moksy.Host without a debugger. Then try to run this test again. "); Proxy = new Proxy(PortNumber); Assert.IsTrue(Proxy.Start(), string.Format("Moksy could not start. Try to manually launch 'Moksy.Host.exe {0}' from the Command Line. ", PortNumber)); Proxy.DeleteAll(); }
public void Initialize() { Proxy = new Proxy(10011); Proxy.DeleteAll(); // Post var s = SimulationFactory.When.I.Post().ToImdb("/Pet/{Kind}/Toy/{Name}/Price", "owner").AsJson().And.NotExists("{Ranking}").Then.AddToImdb().And.Return.StatusCode(System.Net.HttpStatusCode.Created); Proxy.Add(s); s = SimulationFactory.When.I.Post().ToImdb("/Pet/{Kind}/Toy/{Name}/Price", "owner").AsJson().And.Exists("{Ranking}").Then.Return.StatusCode(System.Net.HttpStatusCode.Conflict); Proxy.Add(s); // Put s = SimulationFactory.When.I.Put().ToImdb("/Pet/{Kind}/Toy/{Name}/Price", "owner").AsJson().And.NotExists("{Ranking}").Then.Return.StatusCode(System.Net.HttpStatusCode.Created).Then.AddToImdb(); Proxy.Add(s); s = SimulationFactory.When.I.Put().ToImdb("/Pet/{Kind}/Toy/{Name}/Price", "owner").AsJson().And.Exists("{Ranking}").Then.Return.StatusCode(System.Net.HttpStatusCode.PartialContent).Then.AddToImdb(); Proxy.Add(s); s = SimulationFactory.When.I.Put().ToImdb("/Pet/{Kind}/Toy/{Name}/Price/{Ranking}", "owner").AsJson().And.NotExists("{Ranking}").Then.Return.StatusCode(System.Net.HttpStatusCode.Unauthorized).Then.AddToImdb(); Proxy.Add(s); s = SimulationFactory.When.I.Put().ToImdb("/Pet/{Kind}/Toy/{Name}/Price/{Ranking}", "owner").AsJson().And.Exists("{Ranking}").Then.Return.StatusCode(System.Net.HttpStatusCode.UnsupportedMediaType).Then.AddToImdb(); Proxy.Add(s); // GetById s = SimulationFactory.When.I.Get().FromImdb("/Pet/{Kind}/Toy/{Name}/Price/{Ranking}", "owner").AsJson().And.Exists("{Ranking}").Then.Return.StatusCode(System.Net.HttpStatusCode.OK).And.Body("{value}"); Proxy.Add(s); s = SimulationFactory.When.I.Get().FromImdb("/Pet/{Kind}/Toy/{Name}/Price/{Ranking}", "owner").AsJson().And.NotExists("{Ranking}").Then.Return.StatusCode(System.Net.HttpStatusCode.NotFound); Proxy.Add(s); // Get All s = SimulationFactory.When.I.Get().FromImdb("/Pet/{Kind}/Toy/{Name}/Price", "owner").AsJson().Then.Return.StatusCode(System.Net.HttpStatusCode.PaymentRequired).And.Body("[{value}]"); Proxy.Add(s); }
public void Initialize() { Proxy = new Proxy(10011); Proxy.DeleteAll(); var all = Proxy.GetAll(); Assert.AreEqual(0, all.Count); }
public void Initialize() { Proxy = new Proxy(10011); Proxy.DeleteAll(); }