Beispiel #1
0
        public void ThatTheSameUnitGroupCannotBeAddedTwice()
        {
            var group1 = UnitGroup.Create(new UnitGroupDto
            {
                AllowConversion = true,
                Name            = "massa"
            });
            var group2 = UnitGroup.Create(new UnitGroupDto
            {
                AllowConversion = true,
                Name            = "massa"
            });

            using (GetContext())
            {
                try
                {
                    new UnitGroupRepository(GenFormApplication.SessionFactory)
                    {
                        group1, group2
                    };
                    Assert.Fail("repository should not accept same item twice");
                }
                catch (Exception)
                {
                    Assert.IsTrue(true);
                }
            }
        }
 private IEnumerable <UnitGroup> GetUnitGroupList()
 {
     return(new List <UnitGroup>
     {
         UnitGroup.Create(new UnitGroupDto {
             AllowConversion = true, Name = "volume"
         })
     });
 }
        private static Unit CreateUnit()
        {
            var group =
                UnitGroup.Create(new UnitGroupDto
            {
                Name            = UnitTestFixtures.GetTestUnitMilligram().UnitGroupName,
                AllowConversion = UnitTestFixtures.GetTestUnitMilligram().AllowConversion
            });
            var unit = Unit.Create(UnitTestFixtures.GetTestUnitMilligram(), group);

            return(unit);
        }
 public void ThatConstrucionWithEmptyNameThrowsException()
 {
     try
     {
         UnitGroup.Create(new UnitGroupDto());
         Assert.Fail();
     }
     catch (System.Exception e)
     {
         Assert.IsNotInstanceOfType(e, typeof(AssertFailedException));
     }
 }
Beispiel #5
0
        private Unit CreateUnit()
        {
            var group = UnitGroup.Create(new UnitGroupDto
            {
                AllowConversion = true,
                Name            = "mass"
            });

            return(Unit.Create(new UnitDto
            {
                Abbreviation = "mg",
                AllowConversion = true,
                Divisor = 1000,
                IsReference = true,
                Multiplier = (decimal)0.001,
                Name = "milligram",
                UnitGroupName = "massa"
            }, group));
        }
Beispiel #6
0
        public void CorrectlyMapAProduct()
        {
            var group = UnitGroup.Create(new UnitGroupDto {
                AllowConversion = true, Name = "massa"
            });

            new PersistenceSpecification <Product>(Context.CurrentSession(), new ProductComparer())
            .CheckProperty(x => x.Name, "dopamine Dynatra infusievloeistof 200 mg in 5 mL ampul")
            .CheckProperty(x => x.GenericName, "dopamine")
            .CheckReference(x => x.Brand, Brand.Create(new BrandDto {
                Name = "Dynatra"
            }))
            .CheckProperty(x => x.DisplayName, "dopamine Dynatra infusievloeistof 200 mg in 5 mL ampul")
            .CheckReference(x => x.Package, Package.Create(new PackageDto {
                Name = "ampul", Abbreviation = "amp"
            }))
            .CheckReference(x => x.Shape, Shape.Create(new ShapeDto {
                Name = "infusievloeistof"
            }))
            .CheckProperty(x => x.Quantity, UnitValue.Create(10, Unit.Create(UnitTestFixtures.GetTestUnitMilligram(), group)))

            .VerifyTheMappings();
        }
 public static UnitGroup CreateUnitGroupMass()
 {
     return(UnitGroup.Create(GetDtoMass()));
 }
 public static UnitGroup CreateUnitGroupVolume()
 {
     return(UnitGroup.Create(GetDtoVolume()));
 }
Beispiel #9
0
 private static UnitGroup CreateUnitGroup()
 {
     return(UnitGroup.Create(GetUnitGroupDto()));
 }