Esempio n. 1
0
        public void StopQueue_WithWorkers()
        {
            var workers = new TestWorker[]
            {
#if NETCF
                new TestWorker(_queue, "1"),
                new TestWorker(_queue, "2"),
                new TestWorker(_queue, "3")
#else
                new TestWorker(_queue, "1", ApartmentState.MTA),
                new TestWorker(_queue, "2", ApartmentState.MTA),
                new TestWorker(_queue, "3", ApartmentState.MTA)
#endif
            };

            foreach (var worker in workers)
            {
                worker.Start();
                Assert.That(worker.IsAlive, "Worker thread {0} did not start", worker.Name);
            }

            _queue.Start();
            _queue.Stop();
            Assert.That(_queue.State, Is.EqualTo(WorkItemQueueState.Stopped));

            Thread.Sleep(20);  // Allow time for workers to stop

            foreach (var worker in workers)
                Assert.False(worker.IsAlive, "Worker thread {0} did not stop", worker.Name);
        }
Esempio n. 2
0
        public MyModule()
        {
            Get["/customers/{customerid}"] = _ =>
            {
                var customers = new[]
                {
                    new Customer
                    {
                        Id = 123,
                        Name = "Acme Inc"
                    },
                    new Customer
                    {
                        Id = 456,
                        Name = "Lazer Sharks"
                    }
                };

                return Response.AsJson(customers);
            };

            Get["/customers/{customerid}"] = _ =>
            {
                var customer = new Customer
                {
                    Id = 123,
                    Name = "Acme Inc"
                };

                return Response.AsJson(customer);
            };
        }
Esempio n. 3
0
        private async Task<dynamic> Auth(dynamic _, CancellationToken ct)
        {
            var model = this.Bind<Account>();
            var entity = await _getByEmail.GetResult(model.Email);

            if (entity == null)
            {
                return HttpStatusCode.Unauthorized;
            }

            if (!entity.ValidatePassword(model.Password))
            {
                return HttpStatusCode.Unauthorized;
            }

            var user = new UserIdentity
            {
                UserName = entity.Email,
                Claims = new[] { "admin" }
            };

            var token = _tokenizer.Tokenize(user, Context);

            var response = new
            {
                accessToken = "Token" + token
            };

            return Negotiate.WithModel(response);
        }
        public void Should_publish_price_for_every_registered_pasta()
        {
            // Mock and dependencies setup
            var publisher = Substitute.For<IPastaPricerPublisher>();
            var marketDataProvider = new MarketDataProvider();
            var pastasConfiguration = new[]
                                      {
                                          "gnocchi(eggs-potatoes-flour)",
                                          "spaghetti(eggs-flour)",
                                          "organic spaghetti(organic eggs-flour)",
                                          "spinach farfalle(eggs-flour-spinach)",
                                          "tagliatelle(eggs-flour)",
                                      };

            var unitOfExecutionsFactory = new UnitOfExecutionsFactory();

            var pastaPricer = new PastaPricerEngine(unitOfExecutionsFactory.GetPool(), pastasConfiguration, marketDataProvider, publisher);
            pastaPricer.Start();

            // Turns on market data (note: make the pasta pricer start its dependencies instead?)
            marketDataProvider.Start();

            // A sleep?!? There should be a better way ;-)
            Thread.Sleep(100);

            publisher.Received().Publish("gnocchi", 2.32m);
            publisher.Received().Publish("spaghetti", 1.35m);
            publisher.Received().Publish("organic spaghetti", 0.5m);
            publisher.Received().Publish("spinach farfalle", 0.5m);
            publisher.Received().Publish("tagliatelle", 0.5m);
        }
Esempio n. 5
0
        public void CanDelete()
        {
            var values = new[]
            {
                "{blog_id: 3, comments: [{},{},{}]}",
                "{blog_id: 5, comments: [{},{},{},{}]}",
                "{blog_id: 6, comments: [{},{},{},{},{},{}]}",
                "{blog_id: 7, comments: [{}]}",
                "{blog_id: 3, comments: [{},{},{}]}",
                "{blog_id: 3, comments: [{},{},{},{},{}]}",
                "{blog_id: 2, comments: [{},{},{},{},{},{},{},{}]}",
                "{blog_id: 4, comments: [{},{},{}]}",
                "{blog_id: 5, comments: [{},{}]}",
                "{blog_id: 3, comments: [{},{},{}]}",
                "{blog_id: 5, comments: [{}]}",
            };
            for (int i = 0; i < values.Length; i++)
            {
                db.Put("docs/" + i, null, JObject.Parse(values[i]), new JObject(), null);
            }

            GetUnstableQueryResult("blog_id:3");

            db.Delete("docs/0", null, null);

            var q = GetUnstableQueryResult("blog_id:3");

            Assert.Equal(@"{""blog_id"":""3"",""comments_length"":""11""}", q.Results[0].ToString(Formatting.None));
        }
Esempio n. 6
0
 public void Test_Get_Keys_With_Pattern()
 {
     var keynames = new[] { "key_x", "key_y", "key_z", "foo_a", "foo_b", "foo_c" };
     foreach (var key in keynames)
     {
         r.Set(key, "hello");
     }
     AssertListsAreEqual(r.GetKeys("foo*"), new[] { "foo_a", "foo_b", "foo_c" });
 } 
		public RecipientListPipelineRunner()
		{
			Pipe consumer = PipeSegment.Consumer<ClaimModified>(m => Interlocked.Increment(ref _count));
			Pipe consumer2 = PipeSegment.Consumer<ClaimModified>(m => Interlocked.Increment(ref _count2));

			var recipients = new[] {consumer, consumer2};

			Pipe recipientList = PipeSegment.RecipientList<ClaimModified>(recipients);
			Pipe filter = PipeSegment.Filter<object>(recipientList);
			Pipe objectRecipientList = PipeSegment.RecipientList<object>(new[] {filter});

			_input = PipeSegment.Input(objectRecipientList);

			_message = new ClaimModified();
		}
Esempio n. 8
0
 public void RedisListTest()
 {
     var db = _connectionMultiplexer.GetDatabase();
     const string k = "myList";
     var values = new[] {"a","b","123"};
     db.KeyDelete(k);
     for (var i = 1; i <= values.Length; i++)
     {
         Assert.AreEqual(i,db.ListRightPush(k,values[i-1]));
     }
     foreach (var value in values)
     {
         Assert.AreEqual(value, db.ListLeftPop(k).ToString());
     }
 }
        public void RegisterWindowUsingAttachedProperty()
        {
            // ARRANGE
            var window = new Window();

            var expected = new[]
            {
                new ViewWrapper(window)
            };

            // ACT
            window.SetValue(DialogServiceViews.IsRegisteredProperty, true);
            
            // ASSERT
            Assert.That(DialogServiceViews.Views, Is.EqualTo(expected));
        }
Esempio n. 10
0
        public void Dance()
        {
            var height = Screen.PrimaryScreen.WorkingArea.Height;
            var positions = new[]
            {
                new Position(0, height, 500),

                new Position(height / 16, height / 16 * 15, 500),
                new Position(height / 16 * 2, height / 16 * 14, 500),
                new Position(height / 16 * 3, height / 16 * 13, 500),
                new Position(height / 16 * 4, height / 16 * 12, 500),
                new Position(height / 16 * 6, height / 16 * 10, 500),
                new Position(height / 2, height / 2, 500),

                new Position(height / 2, height / 2 - 100, 250),
                new Position(height / 2, height / 2 - 200, 250),
                new Position(height / 2, height / 2 - 100, 250),
                new Position(height / 2, height / 2, 200),

                new Position(height / 2, height / 2 - 100, 250),
                new Position(height / 2, height / 2 - 200, 250),
                new Position(height / 2, height / 2 - 100, 250),

                new Position(height / 2, height / 2, 500),
                new Position(height / 16 * 6, height / 16 * 10, 500),
                new Position(height / 16 * 4, height / 16 * 12, 500),
                new Position(height / 16 * 3, height / 16 * 13, 500),
                new Position(height / 16 * 2, height / 16 * 14, 500),
                new Position(height / 16, height / 16 * 15, 500),

                new Position(0, height, 0),
            };

            2.Times(i =>
            {
                foreach (var position in positions)
                {
                    formMain.InvokeOnUiThreadIfRequired(() =>
                    {
                        formMain.Top = position.Top;
                        formMain.Height = position.Height;
                    });
                    Thread.Sleep(position.Pause);
                }
            });
        }
Esempio n. 11
0
        public void ShouldNotReturnExludeBasedResults(string requestedStorage)
        {
            var ids = new[]
                {
                    "users/aaa/1",
                    "users/aaa/revisions/1",
                    "users/bbb/1",
                    "users/bbb/revisions/1",
                    "users/bbb/revisions/2",
                    "users/ccc/1"
                };

            using (var store = NewDocumentStore(requestedStorage: requestedStorage))
            {
                using (var session = store.OpenSession())
                {
                    foreach (var id in ids)
                    {
                        session.Store(new { id }, id);
                    }

                    session.SaveChanges();
                }

                using (var session = store.OpenAsyncSession())
                {
                    var results = session.Advanced.LoadStartingWithAsync<dynamic>(
                        keyPrefix: "users/",
                        start: 0,
                        pageSize: 3,
                        exclude: "*/revisions/*");

                    Assert.Equal(3, results.Result.Count());

                    var resultIds = results.Result
                        .Select(x => (string)x.id)
                        .ToList();

                    Assert.Equal(true, resultIds.Contains("users/aaa/1"));
                    Assert.Equal(true, resultIds.Contains("users/bbb/1"));
                    Assert.Equal(true, resultIds.Contains("users/ccc/1"));
                }
            }
        }
Esempio n. 12
0
        public async Task List_files()
        {
            // Arrange
            var files = new[]
            {
                new File("foo.txt", "abc", 8, "some foo", ContentEncoding.Utf8),
                new File("bar.txt", "def", 8, "some bar", ContentEncoding.Utf8)
            };
            var expected = new PagedResponse<File>(files, new RangeResponse(1, 2, 2));
            var connector = Mock.Of<IGalleryConnector>()
                .ThatGetsJson("/acme/sandboxes/john/vanilla/1.2.3/files/front", expected);
            var client = new SandboxesClient(connector);

            // Act
            var result = await client.ListFilesAsync("acme", "john", "vanilla", "1.2.3", "front", null, None);

            // Assert
            result.ShouldBe(expected);
        }
Esempio n. 13
0
        public void StopQueue_WithWorkers()
        {
            var workers = new TestWorker[]
            {
#if NETCF
                new TestWorker(_queue, "1"),
                new TestWorker(_queue, "2"),
                new TestWorker(_queue, "3")
#else
                new TestWorker(_queue, "1", ApartmentState.MTA),
                new TestWorker(_queue, "2", ApartmentState.MTA),
                new TestWorker(_queue, "3", ApartmentState.MTA)
#endif
            };

            foreach (var worker in workers)
            {
                worker.Start();
                Assert.That(worker.IsAlive, "Worker thread {0} did not start", worker.Name);
            }

            _queue.Start();
            _queue.Stop();
            Assert.That(_queue.State, Is.EqualTo(WorkItemQueueState.Stopped));

            int iters = 10;
            int alive = workers.Length;

            while (iters-- > 0 && alive > 0)
            {
                Thread.Sleep(60);  // Allow time for workers to stop

                alive = 0;
                foreach (var worker in workers)
                    if (worker.IsAlive)
                        alive++;
            }

            if (alive > 0)
                foreach (var worker in workers)
                    Assert.False(worker.IsAlive, "Worker thread {0} did not stop", worker.Name);
        }
        public void RegisterFrameworkElementUsingAttachedProperty()
        {
            // ARRANGE
            var frameworkElement = new FrameworkElement();
            
            var window = new Window
            {
                Content = frameworkElement
            };

            var expected = new[]
            {
                new ViewWrapper(frameworkElement)
            };

            // ACT
            frameworkElement.SetValue(DialogServiceViews.IsRegisteredProperty, true);

            // ASSERT
            Assert.That(DialogServiceViews.Views, Is.EqualTo(expected));
        }
Esempio n. 15
0
        public async Task List_files_with_all_parameters()
        {
            // Arrange
            var files = new[]
            {
                new File("foo.txt", "abc", 8, "some foo", ContentEncoding.Utf8),
                new File("bar.txt", "def", 8, "some bar", ContentEncoding.Utf8)
            };
            var expected = new PagedResponse<File>(files, new RangeResponse(1, 2, 2));
            var options = new AppFileListingOptions(new[] {"a", "b"}, 1, 2, true);
            var connector = Mock.Of<IGalleryConnector>()
                .ThatGetsJson("/acme/sandboxes/john/vanilla/1.2.3/files/front?f=a&f=b&_from=1&_to=2&content=true",
                    expected);
            var client = new SandboxesClient(connector);

            // Act
            var result = await client.ListFilesAsync("acme", "john", "vanilla", "1.2.3", "front", options, None);

            // Assert
            result.ShouldBe(expected);
        }
		public void CanGetReducedValues()
		{
			var values = new[]
			{
				"{blog_id: 3, comments: [{},{},{}]}",
				"{blog_id: 5, comments: [{},{},{},{}]}",
				"{blog_id: 6, comments: [{},{},{},{},{},{}]}",
				"{blog_id: 7, comments: [{}]}",
				"{blog_id: 3, comments: [{},{},{}]}",
				"{blog_id: 3, comments: [{},{},{},{},{}]}",
				"{blog_id: 2, comments: [{},{},{},{},{},{},{},{}]}",
				"{blog_id: 4, comments: [{},{},{}]}",
				"{blog_id: 5, comments: [{},{}]}",
				"{blog_id: 3, comments: [{},{},{}]}",
				"{blog_id: 5, comments: [{}]}",
			};
			for (int i = 0; i < values.Length; i++)
			{
				db.Put("docs/" + i, null, RavenJObject.Parse(values[i]), new RavenJObject(), null);
			}

			db.SpinBackgroundWorkers();

			QueryResult q = null;
			for (var i = 0; i < 5; i++)
			{
				do
				{
					q = db.Query("CommentsCountPerBlog", new IndexQuery
					{
						Query = "blog_id:3",
						Start = 0,
						PageSize = 10
					});
					Thread.Sleep(100);
				} while (q.IsStale);
			}
			q.Results[0].Remove("@metadata");
			Assert.Equal(@"{""blog_id"":""3"",""comments_length"":""14""}", q.Results[0].ToString(Formatting.None));
		}
Esempio n. 17
0
        public static void Main()
        {
            var lcdProvider = new GpioLcdTransferProvider(Stm32F4Discovery.Pins.PD1, Stm32F4Discovery.Pins.PD2,
                                                          Stm32F4Discovery.Pins.PD9, Stm32F4Discovery.Pins.PD11,
                                                          Stm32F4Discovery.Pins.PD10, Stm32F4Discovery.Pins.PD8);

            var lcd = new Lcd(lcdProvider);
            lcd.Begin(16, 2); //columns, rows

            //znaki specjalne
            //http://www.quinapalus.com/hd44780udg.html
            var customCharacters = new[]
                                       {
                                           new byte[] {0x00, 0x0a, 0x15, 0x11, 0x11, 0x0a, 0x04, 0x00}, //serce
                                           new byte[] {0x04, 0x02, 0x01, 0x1f, 0x01, 0x02, 0x04, 0x00} //strzalka
                                       };

            //ladowanie znakow specjalnych
            for (int i = 0; i < customCharacters.Length; i++)
                lcd.CreateChar(i, customCharacters[i]);

            lcd.Clear();
            lcd.Write("* Hello World! *");
            Thread.Sleep(3000);

//            lcd.Clear();
//            lcd.Encoding = Encoding.UTF8;
//            lcd.Write("ĄąĆćĘꣳŃńÓ󌜯ż");
//            Thread.Sleep(3000);

            lcd.Clear();
            lcd.WriteByte(0); //pierwszy znak specjalny
            Thread.Sleep(2000);
            lcd.WriteByte(1); //drugi znak specjalny
            Thread.Sleep(3000);

            //nastepna linia
            lcd.SetCursorPosition(0, 1);
            lcd.Write("#     Bye...   #");
        }
        public void When_Type_Object_Int_DateFormat_Is_Json()
        {
            const string key = "OperationBaseTests.When_Type_Object_Int_DateFormat_Is_Json";
            var value = new
            {
                Name = "name",
                Foo = "foo"
            };

            var set = new Set<dynamic>(key, value, GetVBucket(), Transcoder, OperationLifespanTimeout);
            var result = IOService.Execute(set);

            Assert.IsTrue(result.Success);
            Assert.AreEqual(set.Format, DataFormat.Json);

            var get = new Get<dynamic>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);
            var getResult = IOService.Execute(get);

            Assert.IsTrue(getResult.Success);
            Assert.AreEqual(DataFormat.Json, get.Format);
            Assert.AreEqual(Compression.None, get.Compression);
        }
Esempio n. 19
0
        public static void Main()
        {
            var leds = new[]
                           {
                               new OutputPort(Stm32F4Discovery.LedPins.Green, true),
                               new OutputPort(Stm32F4Discovery.LedPins.Orange, true),
                               new OutputPort(Stm32F4Discovery.LedPins.Red, true),
                               new OutputPort(Stm32F4Discovery.LedPins.Blue, true)
                           };

            var rotator = new LedRotator(leds);
            DirectionLed.Write(rotator.Right);

            UserButton.OnInterrupt += (u, data2, time) =>
                                          {
                                              rotator.ChangeDirection();
                                              DirectionLed.Write(rotator.Right);
                                              UserButton.ClearInterrupt();
                                          };

            Blink(leds, 6);
            rotator.Run();
        }
Esempio n. 20
0
		public void CanGetReducedValues()
		{
		    var values = new[]
		    {
		        "{blog_id: 3, comments: [{},{},{}]}",
		        "{blog_id: 5, comments: [{},{},{},{}]}",
		        "{blog_id: 6, comments: [{},{},{},{},{},{}]}",
		        "{blog_id: 7, comments: [{}]}",
		        "{blog_id: 3, comments: [{},{},{}]}",
		        "{blog_id: 3, comments: [{},{},{},{},{}]}",
		        "{blog_id: 2, comments: [{},{},{},{},{},{},{},{}]}",
		        "{blog_id: 4, comments: [{},{},{}]}",
		        "{blog_id: 5, comments: [{},{}]}",
		        "{blog_id: 3, comments: [{},{},{}]}",
		        "{blog_id: 5, comments: [{}]}",
		    };
		    for (int i = 0; i < values.Length; i++)
		    {
		        db.Put("docs/" + i, null, RavenJObject.Parse(values[i]), new RavenJObject(), null);
		    }

		    var q = GetUnstableQueryResult("blog_id:3");
		    Assert.Equal(@"{""blog_id"":3,""comments_length"":14}", q.Results[0].ToString(Formatting.None));
		}
        public override async Task OnActionExecutedAsync(HttpActionExecutedContext aContext, CancellationToken cancellationToken)
        {
            if (aContext.Response == null || aContext.Response.IsSuccessStatusCode)
                return;
            
            var errorList = aContext.ActionContext.ModelState.ToDictionary(
                kvp => kvp.Key,
                kvp => kvp.Value.Errors.Select(e => e.ErrorMessage).ToArray()
                );

            var m = await aContext.Response.Content.ReadAsStringAsync();
            var m2 = JsonConvert.DeserializeObject<JObject>(m)["Message"];

            var model = new
            {
                Message = m2,
                ModelState = errorList,
            };
           

            var json = JsonConvert.SerializeObject(model);

            aContext.Response.Headers.Add("Message", json);
        }
        /// <summary>
        /// Authenticate to Google Using Oauth2
        /// Documentation https://developers.google.com/accounts/docs/OAuth2
        /// </summary>
        /// <param name="clientId">From Google Developer console https://console.developers.google.com</param>
        /// <param name="clientSecret">From Google Developer console https://console.developers.google.com</param>
        /// <param name="userName">A string used to identify a user (locally).</param>
        /// <param name="fileDataStorePath">Name/Path where the Auth Token and refresh token are stored (usually in %APPDATA%)</param>
        /// <param name="applicationName">Applicaiton Name</param>
        /// <returns></returns>
        public CalendarService AuthenticateCalenderOauth(string clientId, string clientSecret, string userName, string fileDataStorePath, string applicationName)
        {
            var scopes = new[]
            {
                CalendarService.Scope.Calendar, // Manage your calendars
                CalendarService.Scope.CalendarReadonly // View your Calendars
            };

            // here is where we Request the user to give us access, or use the Refresh Token that was previously stored in %AppData%
            UserCredential credential =
                GoogleWebAuthorizationBroker.AuthorizeAsync(
                    new ClientSecrets { ClientId = clientId, ClientSecret = clientSecret }
                    , scopes
                    , userName
                    , CancellationToken.None
                    , new FileDataStore(fileDataStorePath)).Result;

            var service = new CalendarService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = applicationName,
            });
            return service;
        }
Esempio n. 23
0
        private async Task<dynamic> Create(dynamic _, CancellationToken ct)
        {
            var model = this.Bind<Models.Account.Post.Account>();
            var validateResult = _validator.Validate(model);

            if (!validateResult.IsValid)
            {
                throw new ValidationException(validateResult.Errors);
            }

            var entity = _mapper.Map<Entities.Account>(model);

            var insertedId = await _create.Execute(entity);

            var response = new
            {
                Id = insertedId
            };

            return
                Negotiate
                    .WithModel(response)
                    .WithStatusCode(HttpStatusCode.Created);
        }
Esempio n. 24
0
        private async Task<dynamic> Create(dynamic _, CancellationToken ct)
        {
            var model = this.Bind<Models.Url.Post.Url>();
            var validateResult = _validator.Validate(model);

            if (!validateResult.IsValid)
            {
                throw new ValidationException(validateResult.Errors);
            }

            var entity = _mapper.Map<Entities.Url>(model);

            entity = await _create.Execute(entity);

            var response = new
            {
                entity.Id,
                Address = $"{Request.Url}/{entity.Shortened}"
            };

            return
                Negotiate
                    .WithModel(response)
                    .WithStatusCode(HttpStatusCode.Created);
        }
Esempio n. 25
0
		public void CanUpdateReduceValue_WhenChangingReduceKey()
		{
			var values = new[]
			{
				"{blog_id: 3, comments: [{},{},{}]}",
				"{blog_id: 5, comments: [{},{},{},{}]}",
				"{blog_id: 6, comments: [{},{},{},{},{},{}]}",
				"{blog_id: 7, comments: [{}]}",
				"{blog_id: 3, comments: [{},{},{}]}",
				"{blog_id: 3, comments: [{},{},{},{},{}]}",
				"{blog_id: 2, comments: [{},{},{},{},{},{},{},{}]}",
				"{blog_id: 4, comments: [{},{},{}]}",
				"{blog_id: 5, comments: [{},{}]}",
				"{blog_id: 3, comments: [{},{},{}]}",
				"{blog_id: 5, comments: [{}]}",
			};
			for (int i = 0; i < values.Length; i++)
			{
				db.Documents.Put("docs/" + i, null, RavenJObject.Parse(values[i]), new RavenJObject(), null);
			}

			GetUnstableQueryResult("blog_id:3");
		    
			db.Documents.Put("docs/0", null, RavenJObject.Parse("{blog_id: 7, comments: [{}]}"), new RavenJObject(), null);

			var q = GetUnstableQueryResult("blog_id:3");
			Assert.Equal(@"{""blog_id"":3,""comments_length"":11}", q.Results[0].ToString(Formatting.None));
		}
		public void HasRouteWorks()
		{
			var expectedRoute = new { controller = "AsyncAction", action = "IndexAsync" };
			RouteAssert.HasRoute(routes, "/AsyncAction/IndexAsync", expectedRoute);
		}
        public void Test_CreateExtras_When_Type_Is_Json()
        {
            var key = "jsonkey";
            var expected = new byte[]
            {
                0x02, 0x00, 0x00, 0x00
            };

            var value = new {x="hi",y=14};
            var set = new Set<dynamic>(key, value, GetVBucket(), Transcoder, OperationLifespanTimeout);
            var bytes = set.CreateExtras();

            Assert.AreEqual(expected[0], bytes[0]);
            Assert.AreEqual(DataFormat.Json, set.Format);
        }
        public void Test_When_Type_Is_Json_Integrated()
        {
            var key = "jsonkey";

            var value = new { x = "hi", y = 14 };
            var set = new Set<dynamic>(key, value, GetVBucket(), Transcoder, OperationLifespanTimeout);
            var setResult = IOService.Execute(set);
            Assert.IsTrue(setResult.Success);
            Assert.AreEqual(DataFormat.Json, set.Format);

            var get = new Get<dynamic>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);
            var getResult = IOService.Execute(get);
            Assert.AreEqual(DataFormat.Json, get.Format);
            Assert.IsTrue(getResult.Success);
        }
		public void ShouldCaptureId()
		{
			var expectedRoute = new { controller = "AsyncAction", action = "IndexAsync", Id = 42 };
			RouteAssert.HasRoute(routes, "/AsyncAction/IndexAsync/42", expectedRoute);
		}
        public void RegisterLoadedView()
        {
            // ARRANGE
            var view = new Mock<FrameworkElementMock>();
            view
                .Setup(mock => mock.IsAlive)
                .Returns(true);
            view
                .Setup(mock => mock.GetOwner())
                .Returns(new Window());

            var expected = new[]
            {
                view.Object
            };
            
            // ACT
            DialogServiceViews.Register(view.Object);

            // ASSERT
            Assert.That(DialogServiceViews.Views, Is.EqualTo(expected));
        }