コード例 #1
0
        public void ThatAddedShapeCanBeFound()
        {
            var shape = ShapeServices.WithDto(ShapeTestFixtures.GetIvFluidDto()).Get();

            Assert.AreEqual(shape, ShapeServices.Shapes.Single(
                                x => x.Name == shape.Name));
        }
コード例 #2
0
        public void ThatShapePackageRelationshipIsBiDirectional()
        {
            var package = PackageServices.WithDto(GetPackageDto()).Get();
            var shape   = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithPackages()).Get();

            Assert.AreEqual(shape, package.ShapeSet.First());
        }
コード例 #3
0
        public void ThatShapeIsAssociatedWithPackage()
        {
            var package = PackageServices.WithDto(GetPackageDto()).Get();
            var shape   = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithPackages()).Get();

            Assert.AreEqual(shape.PackageSet.Single(p => p.Name == package.Name), package);
        }
コード例 #4
0
        public void ThatShapeWithUnitGroupsCanBeDeletedLeavingUnitGroups()
        {
            var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithUnitGroups()).Get();

            ShapeServices.Delete(shape);
            Assert.IsNotNull(UnitGroupServices.UnitGroups.SingleOrDefault(x => x.Name == ShapeTestFixtures.GetValidDtoWithUnitGroups().UnitGroups.First().Name));
        }
コード例 #5
0
        public void ThatShapeUnitGroupRelationshipIsBiDirectional()
        {
            var unitGroup = UnitGroupServices.WithDto(GetUnitGroupDto()).Get();
            var shape     = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithUnitGroups()).Get();

            Assert.AreEqual(shape, unitGroup.Shapes.First());
        }
コード例 #6
0
        public void ThatShapeIsAssociatedWithUnitGroup()
        {
            var unitGroup = UnitGroupServices.WithDto(GetUnitGroupDto()).Get();
            var shape     = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithUnitGroups()).Get();

            Assert.AreEqual(shape.UnitGroupSet.Single(p => p.Name == unitGroup.Name), unitGroup);
        }
コード例 #7
0
        public void ThatShapeRouteRelationshipIsBiDirectional()
        {
            var route = RouteServices.WithDto(GetRouteDto()).Get();
            var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithRoutes()).Get();

            Assert.AreEqual(shape, route.ShapeSet.First());
        }
コード例 #8
0
        public void ThatShapeWithAfterDeleteLeavesPackage()
        {
            var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithPackages()).Get();

            ShapeServices.Delete(shape);
            Assert.IsNotNull(PackageServices.Packages.SingleOrDefault(x => x.Name == ShapeTestFixtures.GetValidDtoWithPackages().Packages.First().Name));
        }
コード例 #9
0
        public void ThatShapeCanBeDeleted()
        {
            var shape = ShapeServices.WithDto(ShapeTestFixtures.GetIvFluidDto()).Get();

            ShapeServices.Delete(shape);
            Assert.IsNull(ShapeServices.Shapes.SingleOrDefault(x => x.Name == ShapeTestFixtures.GetIvFluidDto().Name));
        }
コード例 #10
0
        public void ThatShapeCanBeUpdated()
        {
            var shape = ShapeServices.WithDto(ShapeTestFixtures.GetIvFluidDto()).Get();

            // ToDo: rewrite
            // shape.Environment = shape.Environment + "_changed";
            Assert.IsNotNull(ShapeServices.Shapes.SingleOrDefault(x => x.Name == shape.Name));
        }
コード例 #11
0
        public ActionResult GetShapes()
        {
            var shapes = new List <ShapeDto> {
                ShapeTestFixtures.GetValidDtoWithUnitGroups()
            };

            return(this.Direct(new { success = true, data = shapes }));
        }
コード例 #12
0
        public void ThatShapeIsAssociatedWithRoute()
        {
            var route = RouteServices.WithDto(GetRouteDto()).Get();
            var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithRoutes()).Get();

            var list = new List <IRoute>(shape.Routes);

            Assert.AreEqual(list.Single(p => p.Name == route.Name), route);
        }
コード例 #13
0
        public void AValidShapeWithPackagesCanBeConstructed()
        {
            var shape    = Shape.Create(ShapeTestFixtures.GetValidDtoWithPackages());
            var package1 = Package.Create(ShapeTestFixtures.GetValidDtoWithPackages().Packages.First());
            var package2 = Package.Create(ShapeTestFixtures.GetValidDtoWithPackages().Packages.Last());

            shape.AddPackage(package1);
            shape.AddPackage(package2);
            Assert.IsTrue(ShapeIsValid(shape) && ShapeContainsPackages(shape));
        }
コード例 #14
0
        public ActionResult GetShape(JObject id)
        {
            if (CheckIfIdIsEmpty(id, "id"))
            {
                return(this.Direct(new { success = false }));
            }

            var shape = ShapeTestFixtures.GetValidDtoWithUnitGroups();

            return(this.Direct(new { success = true, result = shape }));
        }
コード例 #15
0
        public void ThatProductCanBeCreatedUsingFluentConstructor()
        {
            var product = Product.Create(ProductTestFixtures.GetProductDtoWithNoSubstances())
                          .Shape(ShapeTestFixtures.CreateIvFluidShape())
                          .Package(PackageTestFixtures.CreatePackageAmpul())
                          .Quantity(UnitTestFixtures.CreateUnitMililiter(), 5M)
                          .Substance(1, SubstanceTestFixtures.CreateSubstanceWithoutGroup(), 200,
                                     UnitTestFixtures.CreateUnitMilligram())
                          .Route(RouteTestFixtures.CreateRouteIv());

            Assert.IsInstanceOfType(product, typeof(Product));
        }
コード例 #16
0
 public void ThatShapeWithoutNameThrowsException()
 {
     try
     {
         var dto = ShapeTestFixtures.GetIvFluidDto();
         dto.Name = String.Empty;
         Shape.Create(dto);
         Assert.Fail();
     }
     catch (Exception e)
     {
         Assert.IsNotInstanceOfType(e, typeof(AssertFailedException));
     }
 }
コード例 #17
0
        public void ThatProductCreateFailsWhenProductHasNoRoute()
        {
            var           dto          = ProductTestFixtures.GetProductDtoWithNoSubstances();
            var           shape        = ShapeTestFixtures.CreateIvFluidShape();
            var           package      = PackageTestFixtures.CreatePackageAmpul();
            const decimal prodQuantity = 5M;
            var           unit         = UnitTestFixtures.CreateUnitMililiter();
            var           subst        = SubstanceTestFixtures.CreateSubstanceWithoutGroup();
            const int     order        = 1;
            const decimal quantity     = 200;
            var           substUnit    = UnitTestFixtures.CreateUnitMilligram();

            AssertCreateFails(quantity, subst, substUnit, null, order, shape, dto, package, prodQuantity, unit);
        }
コード例 #18
0
        public void AValidShapeCanBeConstucted()
        {
            var shape = ShapeTestFixtures.CreateIvFluidShape();

            Assert.IsTrue(ShapeIsValid(shape));
        }
コード例 #19
0
 private UnitGroupDto GetUnitGroupDto()
 {
     return(ShapeTestFixtures.GetValidDtoWithUnitGroups().UnitGroups.First());
 }
コード例 #20
0
 private PackageDto GetPackageDto()
 {
     return(ShapeTestFixtures.GetValidDtoWithPackages().Packages.First());
 }
コード例 #21
0
        public void ThatShapeCanBeGet()
        {
            var shape = ShapeServices.WithDto(ShapeTestFixtures.GetIvFluidDto()).Get();

            Assert.IsNotNull(shape);
        }
コード例 #22
0
 private RouteDto GetRouteDto()
 {
     return(ShapeTestFixtures.GetValidDtoWithRoutes().Routes.First());
 }