Exemplo n.º 1
0
        public void WixMD5WithoutFile()
        {
            using (ShimsContext.Create())
              {
            // Компонент создает Guid сам, вмешаемся.
            System.Fakes.ShimGuid.NewGuid = () => { return Guid.Parse("53773F52-67A0-475E-8622-A2C57E7E6B7B"); };

            WixComponentElement componentOne = new WixComponentElement();
            WixMD5ElementHash hashOne = componentOne.GetMD5();

            Assert.AreEqual(componentOne.GetType().Name, hashOne.Type);
            Assert.AreEqual(componentOne.Id, hashOne.Id);
            Assert.IsNotNull(hashOne.Hash);
            // Должна быть длина 32 символа.
            Assert.AreEqual(32, hashOne.Hash.Length);
            Assert.AreEqual("2b0596edb4097b702f610cf86302233e", hashOne.Hash);
            Assert.IsNull(hashOne.Files);

            WixComponentElement componentTwo = new WixComponentElement();
            WixMD5ElementHash hashTwo = componentTwo.GetMD5();
            Assert.AreEqual(hashOne.Hash, hashTwo.Hash);
              }
        }