当前位置: 首页>>代码示例>>C#>>正文


C# List.Where方法代码示例

本文整理汇总了C#中Microsoft.VisualStudio.TestTools.UnitTesting.List.Where方法的典型用法代码示例。如果您正苦于以下问题:C# List.Where方法的具体用法?C# List.Where怎么用?C# List.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.VisualStudio.TestTools.UnitTesting.List的用法示例。


在下文中一共展示了List.Where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

        public void Init()
        {
            Mock<ICustomerRepository<CustomerModel>> mockCustomerRepository = new Mock<ICustomerRepository<CustomerModel>>();
            Mock<IEngineerRepository<EngineerModel>> mockEngineerRepository = new Mock<IEngineerRepository<EngineerModel>>();
            Mock<IInstallationRepository<InstallationModel>> mockInstallationRepository = new Mock<IInstallationRepository<InstallationModel>>();

            List<EngineerModel> engineers = new List<EngineerModel>
            {
                new EngineerModel {engineerid=0, firstname="Karl", lastname="Maier", password="test123",email="[email protected]", username="karli"}
            };
            List<InstallationModel> installations = new List<InstallationModel>
            {
                new InstallationModel { installationid= 0, customerid=0, description="test", latitude=44, longitude=55, Measurement= new List<int>{0}, serialno="serial"}
            };
            List<CustomerModel> customers = new List<CustomerModel>
            {
                new CustomerModel { customerid=0, engineerid=0, firstname="Anton", lastname="Huber", password="test",email="[email protected]", username="toni", Installation=new List<int> {0}}
            };

            mockCustomerRepository.Setup(mr => mr.GetAll()).Returns(customers);
            mockCustomerRepository.Setup(mr => mr.GetById(It.IsAny<int>())).Returns((int customerid) => customers.Where(customer => customer.customerid == customerid).Single());
            mockCustomerRepository.Setup(mr => mr.Add(It.IsAny<CustomerModel>())).Callback((CustomerModel customer) => customers.Add(customer));
            mockInstallationRepository.Setup(mr => mr.GetByCustomerId(It.IsAny<int>())).Returns((int customerid) => installations.Where(installation => installation.customerid == customerid).ToList<InstallationModel>());
            mockInstallationRepository.Setup(mr => mr.Add(It.IsAny<InstallationModel>())).Callback((InstallationModel installation) => installations.Add(installation));
            mockInstallationRepository.Setup(mr => mr.GetAll()).Returns(installations);
            mockEngineerRepository.Setup(mr => mr.GetMyCustomers(It.IsAny<int>())).Returns((int id) => customers.Where(customer => customer.engineerid == id).ToList<CustomerModel>());

            this.mockcrepo = mockCustomerRepository.Object;
            this.mockirepo = mockInstallationRepository.Object;
            this.mockerepo = mockEngineerRepository.Object;
        }
开发者ID:daniel9992000,项目名称:bif5-sks-csharp,代码行数:31,代码来源:EngineerBLTest.cs

示例2: MoqTests

        /// <summary>
        /// Constructor
        /// </summary>
        public MoqTests()
        {
            // Create Products
            IList<Product> products = new List<Product>
            {
                new Product { ProductId = 1, Name = "C# Unleashed", Description = "Short description here", Price = 49.99 },
                new Product { ProductId = 2, Name = "ASP.Net Unleashed", Description = "Short description here", Price = 59.99 },
                new Product { ProductId = 3, Name = "Silverlight Unleashed", Description = "Short description here", Price = 29.99 }
            };

            // Mock the Products Repository using Moq
            Mock<IProductRepository> mockProductRepository = new Mock<IProductRepository>();

            // Return all the products
            mockProductRepository.Setup(mr => mr.FindAll()).Returns(products);

            // return a product by Id
            mockProductRepository.Setup(mr => mr.FindById(It.IsAny<int>())).Returns((int i) => products.Where(x => x.ProductId == i).Single());

            // return a product by Name
            mockProductRepository.Setup(mr => mr.FindByName(It.IsAny<string>())).Returns((string s) => products.Where(x => x.Name == s).Single());

            // Allows us to test saving a product

            mockProductRepository.Setup(mr => mr.Save(It.IsAny<Product>())).Returns(
                (Product target) =>
                {
                    DateTime now = DateTime.Now;

                    if (target.ProductId.Equals(default(int)))
                    {
                        target.DateCreated = now;
                        target.DateModified = now;
                        target.ProductId = products.Count() + 1;
                        products.Add(target);
                    }
                    else
                    {
                        var original = products.Where(q => q.ProductId == target.ProductId).Single();

                        if (original == null)
                        {
                            return false;
                        }

                        original.Name = target.Name;
                        original.Price = target.Price;
                        original.Description = target.Description;
                        original.DateModified = now;
                    }
                    return true;

                });

            // Complete the setup of our Mock Product Repository
            this.MockProductsRepository = mockProductRepository.Object;
        }
开发者ID:michaeljordan99,项目名称:Scratch,代码行数:60,代码来源:MoqTests.cs

示例3: GetCateListTree

 public static List<StudentDG> GetCateListTree(List<StudentDG> catelisttree)
 {
     foreach (var item in catelisttree)
     {
         var child = catelisttree.Where(t => t.ParenID == item.ID);
         if (child.Any())
             item.ChildList = child.ToList();
     }
     return catelisttree.Where(t => t.ParenID == 0).ToList();
 }
开发者ID:NameIsBad,项目名称:wuliao,代码行数:10,代码来源:DiGui.cs

示例4: GetWithTagsTest

 public void GetWithTagsTest()
 {
     MongoDBLayer dblayer = new MongoDBLayer();
     List<FormData> actual = new List<FormData>();
     actual = dblayer.GetByTagAndContentId<FormData>(Guid.Parse("19c91d63-e3a2-4dae-bb3c-01efc0334b34"), "foo1");
     Assert.IsNotNull(actual);
     Assert.IsTrue(actual.Count > 0);
     Assert.IsNotNull(actual.Where(x => x.Tags.Contains("foo1")).FirstOrDefault<FormData>());
     Assert.AreEqual(actual.Where(x => x.Tags.Contains("foo1")).FirstOrDefault<FormData>().ContentId, Guid.Parse("19c91d63-e3a2-4dae-bb3c-01efc0334b34"));
 }
开发者ID:vishalsharma083,项目名称:MVCFormsV2,代码行数:10,代码来源:MongoDBLayerTests.cs

示例5: ProductControllerTest

        public ProductControllerTest()
        {
            // create some mock products to play with
            IList<Product> products = new List<Product>
            {
            new Product { ProductId = 1, ProductName = "Television",
                ProductDescription = "Sony", Price = 25000 },
            new Product { ProductId = 2, ProductName = "Computer",
                ProductDescription = "Dell", Price = 20000 },
            new Product { ProductId = 4, ProductName = "Table",
                ProductDescription = "Wooden", Price = 600 }
            };

            // Mock the Products Repository using Moq
            Mock<IProductRepository> mockProductRepository = new Mock<IProductRepository>();

            // Return all the products
            mockProductRepository.Setup(mr => mr.FindAll()).Returns(products);

            // return a product by Id

            mockProductRepository.Setup(mr => mr.FindById(It.IsAny<int>())).Returns((int i) => products.Where(x => x.ProductId == i).Single());

            // return a product by Name
            mockProductRepository.Setup(mr => mr.FindByName(It.IsAny<string>())).Returns((string s) => products.Where(x => x.ProductName == s).Single());

            // Allows us to test saving a product
            mockProductRepository.Setup(mr => mr.Save(It.IsAny<Product>())).Returns(
               (Product target) =>
               {
                   if (target.ProductId.Equals(default(int)))
                   {
                       target.ProductId = products.Max(q => q.ProductId) + 1;
                       //target.ProductId = products.Count() + 1;
                       products.Add(target);
                   }
                   else
                   {
                       var original = products.Where(q => q.ProductId == target.ProductId).SingleOrDefault();

                       if (original != null)
                       {
                           return false;
                       }

                       products.Add(target);
                   }

                   return true;
               });

            // Complete the setup of our Mock Product Repository
            this.MockProductsRepository = mockProductRepository.Object;
        }
开发者ID:Nagendra12122,项目名称:MVC3-Order-Management-System,代码行数:54,代码来源:ProductControllerTest.cs

示例6: CreateMockContext

        /// <summary>The create mock context.</summary>
        /// <returns>The <see cref="Mock" />.</returns>
        public static Mock<IDatabaseContext> CreateMockContext()
        {
            Mock<IDatabaseContext> contextMock = new Mock<IDatabaseContext>();
            IQueryable<Region> regions = new List<Region>
            {
                new Region { Id = 1, CountryId = 1, Name = "England" },
                new Region { Id = 2, CountryId = 1, Name = "Scotland" },
                new Region { Id = 3, CountryId = 1, Name = "Wales" },
                new Region { Id = 4, CountryId = 1, Name = "Northen Ireland" },
                new Region { Id = 5, CountryId = 2, Name = "Queensland" },
                new Region { Id = 6, CountryId = 2, Name = "Victoria" },
                new Region { Id = 7, CountryId = 2, Name = "Tasmania" },
                new Region { Id = 8, CountryId = 2, Name = "New South Wales" }
            }.AsQueryable();

            IQueryable<Country> coutries = new List<Country>
            {
                new Country
                {
                    Id = 1, Name = "United Kingdom", Regions = regions.Where(a => a.CountryId == 1).ToList()
                },
                new Country
                {
                    Id = 2, Name = "Australia", Regions = regions.Where(a => a.CountryId == 2).ToList()
                }
            }.AsQueryable();

            foreach (Region region in regions)
            {
                region.Country = coutries.First(a => a.Id == region.CountryId);
            }

            Mock<IDbSet<Country>> countryMock = new Mock<IDbSet<Country>>();
            countryMock.As<IQueryable<Country>>().Setup(m => m.Provider).Returns(coutries.Provider);
            countryMock.As<IQueryable<Country>>().Setup(m => m.Expression).Returns(coutries.Expression);
            countryMock.As<IQueryable<Country>>().Setup(m => m.ElementType).Returns(coutries.ElementType);
            countryMock.As<IQueryable<Country>>().Setup(m => m.GetEnumerator()).Returns(coutries.GetEnumerator());

            Mock<IDbSet<Region>> regionMock = new Mock<IDbSet<Region>>();
            regionMock.As<IQueryable<Region>>().Setup(m => m.Provider).Returns(regions.Provider);
            regionMock.As<IQueryable<Region>>().Setup(m => m.Expression).Returns(regions.Expression);
            regionMock.As<IQueryable<Region>>().Setup(m => m.ElementType).Returns(regions.ElementType);
            regionMock.As<IQueryable<Region>>().Setup(m => m.GetEnumerator()).Returns(regions.GetEnumerator());

            contextMock.Setup(a => a.Countries).Returns(countryMock.Object);
            contextMock.Setup(a => a.Regions).Returns(regionMock.Object);

            // verify that the mocking is setup correctly
            List<Region> result = contextMock.Object.Countries.Include(a => a.Regions).SelectMany(a => a.Regions).ToList();
            Assert.AreEqual(regions.Count(), result.Count);

            return contextMock;
        }
开发者ID:segall,项目名称:LMBTech,代码行数:55,代码来源:TestHelper.cs

示例7: ObjectEventNotifierOutOfRangeTestMethod

 public void ObjectEventNotifierOutOfRangeTestMethod()
 {
     FileInfo _testDataFileInfo = new FileInfo(@"ModelsWithErrors\WrongEventNotifier.xml");
       Assert.IsTrue(_testDataFileInfo.Exists);
       List<TraceMessage> _trace = new List<TraceMessage>();
       int _diagnosticCounter = 0;
       IAddressSpaceContext _as = new AddressSpaceContext(z => TraceDiagnostic(z, _trace, ref _diagnosticCounter));
       Assert.IsNotNull(_as);
       _as.ImportUANodeSet(_testDataFileInfo);
       Assert.AreEqual<int>(0, _trace.Where<TraceMessage>(x => x.BuildError.Focus != Focus.Diagnostic).Count<TraceMessage>());
       _as.ValidateAndExportModel(m_NameSpace);
       Assert.AreEqual<int>(1, _trace.Where<TraceMessage>(x => x.BuildError.Focus != Focus.Diagnostic).Count<TraceMessage>());
 }
开发者ID:yuriik83,项目名称:OPC-UA-OOI,代码行数:13,代码来源:UANodeSetWithErrorsUnitTest.cs

示例8: NotSupportedFeature

 public void NotSupportedFeature()
 {
     FileInfo _testDataFileInfo = new FileInfo(@"ModelsWithErrors\NotSupportedFeature.xml");
       Assert.IsTrue(_testDataFileInfo.Exists);
       List<TraceMessage> _trace = new List<TraceMessage>();
       int _diagnosticCounter = 0;
       IAddressSpaceContext _as = new AddressSpaceContext(z => TraceDiagnostic(z, _trace, ref _diagnosticCounter));
       Assert.IsNotNull(_as);
       _as.ImportUANodeSet(_testDataFileInfo);
       Assert.AreEqual<int>(0, _trace.Where<TraceMessage>(x => x.BuildError.Focus != Focus.Diagnostic).Count<TraceMessage>());
       _as.ValidateAndExportModel(m_NameSpace);
       Assert.AreEqual<int>(1, _trace.Where<TraceMessage>(x => x.BuildError.Focus != Focus.Diagnostic).Count<TraceMessage>());
       Assert.AreEqual<int>(1, _trace.Where<TraceMessage>(x => x.BuildError.Identifier == "P0-0001010000").Count<TraceMessage>());
 }
开发者ID:yuriik83,项目名称:OPC-UA-OOI,代码行数:14,代码来源:UANodeSetWithErrorsUnitTest.cs

示例9: Initialize

        public void Initialize()
        {
            List<IUser> users = new List<IUser> {
                new User(198724),
                new User(9218)
            };
            users = users.Where(x => x.EmployeeID == 198724).Select(usr => { usr.Name = "tatsumoto, takashi"; return usr; }).ToList();
            users = users.Where(x => x.EmployeeID == 198724).Select(usr => { usr.NTLogin = "takashi.tatsumoto"; return usr; }).ToList();
            users = users.Where(x => x.EmployeeID == 198724).Select(usr => { usr.ManagerID = 9218; return usr; }).ToList();

            //svc.Setup(x => x.getUser(It.IsAny<int>())).Returns((int empID) => { return users.Single(y => y.EmployeeID == empID); });
            //svc.Setup(x => x.getAllUsers()).Returns(users);
            svc.Setup(x => x.getAllUsers()).Returns(users);
        }
开发者ID:tah182,项目名称:Comet,代码行数:14,代码来源:UserSvcImplDBTest.cs

示例10: Setup

        public void Setup()
        {
            _board = new Mock<IBasicBoard>();

            //0000000
            //0111110
            //0121210
            //0111110
            //0121110
            //0111110
            //0000000
            var testBoard = new List<IBasicPolygon>();

            for (int x = 0; x < 7; x++)
            {
                for (int y = 0; y < 7; y++)
                {
                    if (y == 0 || y == 6 || x == 0 || x == 6)
                    {
                        var solid = new BasicPolygon();
                        solid.State = PolygonState.Solid;
                        solid.Coordintes = new Point3d() { X = x, Y = y };
                        testBoard.Add(solid);
                    }
                    else
                    {
                        var empty = new BasicPolygon();
                        empty.State = PolygonState.Empty;
                        empty.Coordintes = new Point3d() { X = x, Y = y };
                        testBoard.Add(empty);
                    }
                }
            }

            var cellToFill = testBoard.Where(c => c.Coordintes.X == 2 && c.Coordintes.Y == 2).First();
            cellToFill.State = PolygonState.Filled;
            cellToFill = testBoard.Where(c => c.Coordintes.X == 4 && c.Coordintes.Y == 4).First();
            cellToFill.State = PolygonState.Filled;
            cellToFill = testBoard.Where(c => c.Coordintes.X == 2 && c.Coordintes.Y == 4).First();
            cellToFill.State = PolygonState.Filled;

            _board.SetupGet(b => b.Cells).Returns(testBoard);

            _game = new Mock<ILonerGame>();
            _game.SetupGet(g => g.Board).Returns(_board.Object);

            _rules = new StandardRules();

            _rules.Game = _game.Object;
        }
开发者ID:brajan1984,项目名称:GamePlatform,代码行数:50,代码来源:StandardRulesTests.cs

示例11: ShorcikLinqTest

        public void ShorcikLinqTest()
        {
            List<ListLinq> lista = new List<ListLinq>();
            lista.Add(new ListLinq() {Imie = "Rafal", Nazwisko = "Bedkowski", Wiek = 40});
            lista.Add(new ListLinq() {Imie = "Mariusz", Nazwisko = "Mularczyk", Wiek = 16});
            lista.Add(new ListLinq() {Imie = "Bartłomiej", Nazwisko = "Korcz", Wiek = 25});
            lista.Add(new ListLinq() {Imie = "Adam", Nazwisko = "Ficek", Wiek = 33});
            lista.Add(new ListLinq() {Imie = "Amelia", Nazwisko = "Dydko", Wiek = 46});

            var counter = lista.Count;
            var wynik = lista.Where(x=>x.Imie.Equals("Rafal"));
            var latka = lista.Where(x => x.Wiek > 25);
            var next = lista.Average(x => x.Wiek);
            Console.ReadKey();
        }
开发者ID:sparrow41,项目名称:training,代码行数:15,代码来源:TestLinq.cs

示例12: CaseInsensitiveComparison

        public void CaseInsensitiveComparison()
        {
            List<GitInstallation> list = new List<GitInstallation>
            {
                new GitInstallation(@"C:\Program Files (x86)\Git", KnownGitDistribution.GitForWindows32v1),
                new GitInstallation(@"C:\Program Files (x86)\Git", KnownGitDistribution.GitForWindows32v2),
                new GitInstallation(@"C:\Program Files\Git", KnownGitDistribution.GitForWindows32v1),
                new GitInstallation(@"C:\Program Files\Git", KnownGitDistribution.GitForWindows32v2),
                new GitInstallation(@"C:\Program Files\Git", KnownGitDistribution.GitForWindows64v2),
                // ToLower versions
                new GitInstallation(@"C:\Program Files (x86)\Git".ToLower(), KnownGitDistribution.GitForWindows32v1),
                new GitInstallation(@"C:\Program Files (x86)\Git".ToLower(), KnownGitDistribution.GitForWindows32v2),
                new GitInstallation(@"C:\Program Files\Git".ToLower(), KnownGitDistribution.GitForWindows32v1),
                new GitInstallation(@"C:\Program Files\Git".ToLower(), KnownGitDistribution.GitForWindows32v2),
                new GitInstallation(@"C:\Program Files\Git".ToLower(), KnownGitDistribution.GitForWindows64v2),
                // ToUpper versions
                new GitInstallation(@"C:\Program Files (x86)\Git".ToUpper(), KnownGitDistribution.GitForWindows32v1),
                new GitInstallation(@"C:\Program Files (x86)\Git".ToUpper(), KnownGitDistribution.GitForWindows32v2),
                new GitInstallation(@"C:\Program Files\Git".ToUpper(), KnownGitDistribution.GitForWindows32v1),
                new GitInstallation(@"C:\Program Files\Git".ToUpper(), KnownGitDistribution.GitForWindows32v2),
                new GitInstallation(@"C:\Program Files\Git".ToUpper(), KnownGitDistribution.GitForWindows64v2),
            };

            HashSet<GitInstallation> set = new HashSet<GitInstallation>(list);

            Assert.AreEqual(15, list.Count);
            Assert.AreEqual(5, set.Count);

            Assert.AreEqual(6, list.Where(x => x.Version == KnownGitDistribution.GitForWindows32v1).Count());
            Assert.AreEqual(6, list.Where(x => x.Version == KnownGitDistribution.GitForWindows32v2).Count());
            Assert.AreEqual(3, list.Where(x => x.Version == KnownGitDistribution.GitForWindows64v2).Count());

            Assert.AreEqual(2, set.Where(x => x.Version == KnownGitDistribution.GitForWindows32v1).Count());
            Assert.AreEqual(2, set.Where(x => x.Version == KnownGitDistribution.GitForWindows32v2).Count());
            Assert.AreEqual(1, set.Where(x => x.Version == KnownGitDistribution.GitForWindows64v2).Count());

            foreach (var v in Enum.GetValues(typeof(KnownGitDistribution)))
            {
                KnownGitDistribution kgd = (KnownGitDistribution)v;

                var a = list.Where(x => x.Version == kgd);
                Assert.IsTrue(a.All(x => x != a.First() || GitInstallation.PathComparer.Equals(x.Cmd, a.First().Cmd)));
                Assert.IsTrue(a.All(x => x != a.First() || GitInstallation.PathComparer.Equals(x.Config, a.First().Config)));
                Assert.IsTrue(a.All(x => x != a.First() || GitInstallation.PathComparer.Equals(x.Git, a.First().Git)));
                Assert.IsTrue(a.All(x => x != a.First() || GitInstallation.PathComparer.Equals(x.Libexec, a.First().Libexec)));
                Assert.IsTrue(a.All(x => x != a.First() || GitInstallation.PathComparer.Equals(x.Sh, a.First().Sh)));
            }
        }
开发者ID:Quitch,项目名称:Git-Credential-Manager-for-Windows,代码行数:48,代码来源:GitInstallationTests.cs

示例13: Data_on_child

        public void Data_on_child()
        {
            var nodes = new List<FakeNode>();
            nodes.Add(new FakeNode() { Parent = "A", Child = "A1" });

            var rights = new List<KeyValuePair<string, string>>();
            rights.Add(new KeyValuePair<string, string>("A1", "1"));
            rights.Add(new KeyValuePair<string, string>("A1", "2"));

            var tree = TreeBuilder.Build<string, IEnumerable<string>, FakeNode>(
                nodes,
                x => x.Parent,
                x => x.Child,
                x => rights.Where(n => n.Key.Equals(x)).Select(v => v.Value));

            tree.Count().Should().Be(1);

            var a = tree.FirstOrDefault();
            a.Children.Count().Should().Be(1);

            var a1 = a.Children.First();
            a1.Data.Should().NotBeNull();
            a1.Data.Count().Should().Be(2);
            a1.Data.FirstOrDefault(x => x == "1").Should().NotBeNull();
            a1.Data.FirstOrDefault(x => x == "2").Should().NotBeNull();
        }
开发者ID:jbinder,项目名称:dragon,代码行数:26,代码来源:TreeBuilderTest.cs

示例14: Can_Add_Order_Via_Controller

        public void Can_Add_Order_Via_Controller()
        {
            //ARRANGE
            List<Order> orders = new List<Order>();
            Mock<IOrderRepository> mockOrder = new Mock<IOrderRepository>();
            mockOrder.Setup(m => m.AddOrder(It.IsAny<Order>())).Returns((Order order) =>
            {
                if (orders.LastOrDefault() == null)
                {
                    order.OrderID = 1;
                }
                else
                {
                    order.OrderID = orders.Last().OrderID + 1;
                }
                orders.Add(order);
                return true;
            });
            mockOrder.Setup(m => m.GetOrder(It.IsAny<int>())).Returns((int id) =>
            {
                return orders.Where(o => o.OrderID == id).FirstOrDefault();
            });
            OrderController target = new OrderController(mockOrder.Object);

            //ACT
            target.Index(new Order { Address = "lalala st.", Name = "lala", OrderDate = DateTime.Now });
            target.Index(new Order { Address = "dadada st.", Name = "dada", OrderDate = DateTime.Now });

            //ASSERT
            Assert.IsNotNull(orders.Last());
            Assert.AreEqual(orders.Last().Name, "dada");
            Assert.AreEqual(orders.Last().OrderID, orders.First().OrderID + 1);
        }
开发者ID:KeepRollin,项目名称:CoffeeAppRepo,代码行数:33,代码来源:UnitTest1.cs

示例15: test_that_given_a_repository_with_many_changesets_the_latest_changeset_is_returned_by_get

        public void test_that_given_a_repository_with_many_changesets_the_latest_changeset_is_returned_by_get()
        {
            // arrange
            var changes = new List<SpeakerChange>
                              {
                                  new SpeakerChange() { Version = 1 },
                                  new SpeakerChange() { Version = 1 },
                                  new SpeakerChange() { Version = 2 }
                              };
            var mock = new Mock<ISpeakerChangeRepository>();
            mock.Setup(m => m.GetLatest()).Returns(() =>
                                                    {
                                                        int latestVersion = changes.Max(c => c.Version);
                                                        return changes.Where(c => c.Version == latestVersion).ToList();
                                                    });

            _container.Bind<ISpeakerChangeRepository>().ToConstant(mock.Object);

            // act
            var controller = (SpeakerChangeController)_container.Get<IHttpController>("SpeakerChange", new IParameter[0]);
            var result = controller.Get();

            // assert
            Assert.AreNotEqual(0, result.Count());
        }
开发者ID:xximjasonxx,项目名称:Codemash,代码行数:25,代码来源:SpeakerChangeControllerTests.cs


注:本文中的Microsoft.VisualStudio.TestTools.UnitTesting.List.Where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。