Exemplo n.º 1
0
        public void ApplicationId()
        {
            var appId = Guid.NewGuid();
            var data  = new BytesStoredData(appId);

            Assert.AreEqual <Guid>(appId, data.ApplicationId);
        }
Exemplo n.º 2
0
        public void ObjectType()
        {
            var data = new BytesStoredData(Guid.NewGuid());
            var test = StringHelper.ValidString();

            data.ObjectType = test;
            Assert.AreEqual <string>(test, data.ObjectType);
        }
Exemplo n.º 3
0
        public void Bytes()
        {
            var random = new Random();
            var data   = new BytesStoredData(Guid.NewGuid());
            var test   = random.Next();

            data.Bytes = test;
            Assert.AreEqual <int>(test, data.Bytes);
        }
Exemplo n.º 4
0
        public void StoreByteCount(Guid applicationId, DataCostType costType, ICollection data)
        {
            Contract.Requires <ArgumentOutOfRangeException>(Guid.Empty != applicationId);

            Contract.Requires <ArgumentNullException>(null != data);

            var stored = new BytesStoredData(applicationId)
            {
                ObjectType   = data.GetType().ToString(),
                Bytes        = DataCostCalculator.Calculate(data),
                DataCostType = (int)costType
            };

            this.bytesTable.AddEntity(stored);
        }
Exemplo n.º 5
0
        public void Convert()
        {
            var random = new Random();
            var data   = new BytesStoredData(Guid.NewGuid())
            {
                Bytes        = random.Next(),
                DataCostType = random.Next(),
                ObjectType   = StringHelper.ValidString(),
                OccurredOn   = DateTime.UtcNow,
            };

            var converted = data.Convert();

            Assert.AreEqual <int>(data.Bytes, converted.Bytes);
            Assert.AreEqual <int>(data.DataCostType, converted.DataCostType);
            Assert.AreEqual <string>(data.ObjectType, converted.ObjectType);
            Assert.AreEqual <DateTime>(data.OccurredOn, converted.OccurredOn);
            Assert.AreEqual <Guid>(data.ApplicationId, converted.ApplicationId);
        }