示例#1
0
        public void ShouldBeAbleToMapIdentity()
        {
            State.Event.Mapper subject = new State.Event.Mapper();

            var identity = subject.Map <With.Component.IIdentity, State.Component.Identity>(Identity);

            Assert.IsNotNull(identity);
            Assert.AreEqual(Identity.ToString(), identity.Value);
        }
示例#2
0
        public void ShouldBeAbleToMapMeasurement()
        {
            State.Event.Mapper subject = new State.Event.Mapper();

            var measurement = subject.Map <With.Component.IMeasurement, State.Component.Measurement>(Measurement);

            Assert.IsNotNull(measurement);
            Assert.AreEqual(Measurement.Type, measurement.Type);
            Assert.AreEqual(Measurement.Value, measurement.Value);
        }
示例#3
0
        public void ShouldBeAbleToMapParameter()
        {
            State.Event.Mapper subject = new State.Event.Mapper();

            var parameter = subject.Map <With.Component.IParameter, State.Component.Parameter>(Parameter);

            Assert.IsNotNull(parameter);
            Assert.IsNotNull(parameter.Identity);
            Assert.IsNotNull(parameter.Description);
        }
示例#4
0
        public void ShouldBeAbleToMapObservable()
        {
            State.Event.Mapper subject = new State.Event.Mapper();

            var observable = subject.Map <With.Component.IObservable, State.Component.Observable>(Observable);

            Assert.IsNotNull(observable);
            Assert.IsNotNull(observable.Identity);
            Assert.IsNotNull(observable.Description);
        }
示例#5
0
        public void ShouldBeAbleToMapActionable()
        {
            State.Event.Mapper subject = new State.Event.Mapper();

            var actionable = subject.Map <With.Component.IActionable, State.Component.Actionable>(Actionable);

            Assert.IsNotNull(actionable);
            Assert.IsNotNull(actionable.Identity);
            Assert.IsNotNull(actionable.Description);
            Assert.IsNotNull(actionable.Parameters);
            Assert.AreEqual(1, actionable.Parameters.Count());
        }
示例#6
0
        public void ShouldBeAbleToMapDeregistrationMessage()
        {
            With.Message.IDeregister deregistration = A.Fake <With.Message.IDeregister>();
            A.CallTo(() => deregistration.Registrar).Returns(Identity);
            A.CallTo(() => deregistration.Entity).Returns(Identity);

            State.Event.Mapper subject = new State.Event.Mapper();

            State.Event.Deregistered actual = subject.Map(deregistration);

            Assert.AreEqual(deregistration.Registrar.ToString(), actual.Registrar.Value);
            Assert.AreEqual(deregistration.Entity.ToString(), actual.Entity.Value);
        }
示例#7
0
        public void ShouldBeAbleToMapEntity()
        {
            State.Event.Mapper subject = new State.Event.Mapper();

            var entity = subject.Map <With.Component.IEntity, State.Component.Entity>(Entity);

            Assert.IsNotNull(entity);
            Assert.IsNotNull(entity.Identity);
            Assert.IsNotNull(entity.Description);
            Assert.IsNotNull(entity.Observables);
            Assert.AreEqual(1, entity.Observables.Count());
            Assert.AreEqual(1, entity.Actionables.Count());
        }
示例#8
0
        public void ShouldBeAbleToMapEntityDescription()
        {
            State.Event.Mapper subject = new State.Event.Mapper();

            var entityDescription = subject.Map <With.Component.IEntityDescription, State.Component.EntityDescription>(EntityDescription);

            Assert.IsNotNull(entityDescription);
            Assert.AreEqual(EntityDescription.Name, entityDescription.Name);
            Assert.AreEqual(EntityDescription.Remarks, entityDescription.Remarks);
            Assert.AreEqual(EntityDescription.Type, entityDescription.Type);
            Assert.AreEqual(EntityDescription.Manufacturer, entityDescription.Manufacturer);
            Assert.AreEqual(EntityDescription.Model, entityDescription.Model);
        }
示例#9
0
        public void ShouldBeAbleToMapValueDescription()
        {
            State.Event.Mapper subject = new State.Event.Mapper();

            var description = subject.Map <With.Component.IValueDescription, State.Component.ValueDescription>(ValueDescription);

            Assert.IsNotNull(description);
            Assert.AreEqual(ValueDescription.Name, description.Name);
            Assert.AreEqual(ValueDescription.Remarks, description.Remarks);
            Assert.IsNotNull(description.Measurement);
            Assert.IsNotNull(description.Default);
            Assert.IsNotNull(description.Minimum);
            Assert.IsNotNull(description.Maximum);
        }
示例#10
0
        public void ShouldBeAbleToMapObservationMessage()
        {
            DateTimeOffset date = new DateTimeOffset(2014, 04, 06, 10, 20, 00, TimeSpan.Zero);

            With.Message.IObservation observation = A.Fake <With.Message.IObservation>();
            A.CallTo(() => observation.Entity).Returns(Identity);
            A.CallTo(() => observation.Observable).Returns(Identity);
            A.CallTo(() => observation.Date).Returns(date);
            A.CallTo(() => observation.Measurement).Returns(Measurement);

            State.Event.Mapper subject = new State.Event.Mapper();

            State.Event.Observed actual = subject.Map(observation);

            Assert.AreEqual(observation.Entity.ToString(), actual.Entity.Value);
            Assert.AreEqual(observation.Observable.ToString(), actual.Observable.Value);
            Assert.AreEqual(observation.Date, actual.Date);
            Assert.IsNotNull(actual.Measurement);
        }