コード例 #1
0
        public void GetPackageWithIncorrectIdThatReturnEmptyPackage()
        {
            var context    = new Mock <ISalesContext>();
            var packageBLL = new PackageBLL(context.Object);

            var nullFake = new List <Package>();

            var packageMock = createDbSetMock <Package>(nullFake);

            context.Setup(x => x.Packages).Returns(packageMock.Object);

            PackageItemDTO package = packageBLL.GetPackage(7);

            Assert.Null(package);
        }
コード例 #2
0
        public void GetPackageWithDescriptionAsMarDelPlata()
        {
            var context    = new Mock <ISalesContext>();
            var packageBLL = new PackageBLL(context.Object);

            var mdqFake = new List <Package> {
                new Package {
                    PackageId    = 1,
                    Description  = "Mar del plata",
                    PackageItems = new List <PackageItem> {
                    }
                }
            };

            var packageMock = createDbSetMock <Package>(mdqFake);

            context.Setup(x => x.Packages).Returns(packageMock.Object);

            PackageItemDTO package = packageBLL.GetPackage(1);

            Assert.Equal((string)"Mar del plata", package.Description);
        }