Exemplo n.º 1
0
            public async Task Updates_IpAddresses_On_Existing_Item()
            {
                var services = new[] {
                    new Service()
                    {
                        ServiceId = "Test1"
                    },
                    new Service()
                    {
                        ServiceId = "Test2"
                    },
                    new Service()
                    {
                        ServiceId = "Test3"
                    },
                };
                var store = new InMemoryServiceStore(services);

                await store.StoreAsync(new Service()
                {
                    ServiceId = "Test2", IpAddresses = new [] { "10.10.0.2" }
                });

                var service = await store.FindByServiceIdAsync("Test2");

                service.Should().NotBeNull();
                service.IpAddresses.Should().HaveCount(1);
                service.IpAddresses[0].Should().Be("10.10.0.2");
            }
Exemplo n.º 2
0
            public async Task Updates_PublicUrls_On_Existing_Item()
            {
                var services = new[] {
                    new Service()
                    {
                        ServiceId = "Test1"
                    },
                    new Service()
                    {
                        ServiceId = "Test2"
                    },
                    new Service()
                    {
                        ServiceId = "Test3"
                    },
                };
                var store = new InMemoryServiceStore(services);

                await store.StoreAsync(new Service()
                {
                    ServiceId = "Test2", PublicUrls = new [] { new Uri("Http://test.com") }
                });

                var service = await store.FindByServiceIdAsync("Test2");

                service.Should().NotBeNull();
                service.PublicUrls.Should().HaveCount(1);
                service.PublicUrls[0].Should().Be(new Uri("http://test.com"));
            }
Exemplo n.º 3
0
            public async Task Adds_Service_To_List()
            {
                var services = new[] {
                    new Service()
                    {
                        ServiceId = "Test1"
                    },
                    new Service()
                    {
                        ServiceId = "Test2"
                    }
                };
                var store = new InMemoryServiceStore(services);

                (await store.GetAllAsync()).Should().HaveCount(2);

                await store.StoreAsync(new Service()
                {
                    ServiceId = "Test3"
                });

                var items = await store.GetAllAsync();

                items.Should().HaveCount(3);
                items.Should().Contain(s => s.ServiceId == "Test1");
                items.Should().Contain(s => s.ServiceId == "Test2");
                items.Should().Contain(s => s.ServiceId == "Test3");
            }