Exemple #1
0
        public void ThatAddedShapeCanBeFound()
        {
            var shape = ShapeServices.WithDto(ShapeTestFixtures.GetIvFluidDto()).Get();

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

            Assert.AreEqual(shape, package.ShapeSet.First());
        }
Exemple #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);
        }
Exemple #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));
        }
Exemple #5
0
        public void ThatShapeUnitGroupRelationshipIsBiDirectional()
        {
            var unitGroup = UnitGroupServices.WithDto(GetUnitGroupDto()).Get();
            var shape     = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithUnitGroups()).Get();

            Assert.AreEqual(shape, unitGroup.Shapes.First());
        }
Exemple #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);
        }
Exemple #7
0
        public void ThatShapeRouteRelationshipIsBiDirectional()
        {
            var route = RouteServices.WithDto(GetRouteDto()).Get();
            var shape = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithRoutes()).Get();

            Assert.AreEqual(shape, route.ShapeSet.First());
        }
Exemple #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));
        }
Exemple #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));
        }
Exemple #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));
        }
        public ActionResult GetShapes()
        {
            var shapes = new List <ShapeDto> {
                ShapeTestFixtures.GetValidDtoWithUnitGroups()
            };

            return(this.Direct(new { success = true, data = shapes }));
        }
Exemple #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);
        }
Exemple #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));
        }
        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 }));
        }
Exemple #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));
        }
Exemple #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));
     }
 }
Exemple #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);
        }
Exemple #18
0
        public void AValidShapeCanBeConstucted()
        {
            var shape = ShapeTestFixtures.CreateIvFluidShape();

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

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