Beispiel #1
0
        public void GetGPUsByManufacture_GetGPUsFromRepository_RightEntitysReturned()
        {
            //Arrange
            Guid       guid1   = Guid.NewGuid();
            Guid       guid2   = Guid.NewGuid();
            Guid       guid3   = Guid.NewGuid();
            List <GPU> gpuList = new List <GPU> {
                new GPU {
                    ProductGuid = guid1, Name = "Name1"
                },
                new GPU {
                    ProductGuid = guid2, Name = "Name2"
                },
                new GPU {
                    ProductGuid = guid3, Name = "Name3"
                }
            };

            GPUs.Setup(x => x.Get(It.IsAny <Expression <Func <GPU, bool> > >()))
            .Returns(gpuList.AsQueryable());

            //Act
            var result = buildService.GetGPUsByDeveloper("Developer1");

            //Assert
            Assert.IsNotNull(result.Where(x => x.ProductGuid == guid1), "guid1 is missing");
            Assert.IsNotNull(result.Where(x => x.ProductGuid == guid2), "guid2 is missing");
            Assert.IsNotNull(result.Where(x => x.ProductGuid == guid3), "guid3 is missing");

            Assert.IsNotNull(result
                             .Where(x => x.Name == gpuList[0].Name), gpuList[0].Name + "is missing");
            Assert.IsNotNull(result
                             .Where(x => x.Name == gpuList[1].Name), gpuList[1].Name + " is missing");
            Assert.IsNotNull(result
                             .Where(x => x.Name == gpuList[2].Name), gpuList[2].Name + " is missing");
        }