예제 #1
0
        public void New_NetworkDevice_Has_Created_Event_Uncommitted()
        {
            Guid deviceId = Guid.NewGuid();
            string hostname = "SESM-001";
            NetworkDevice device = new NetworkDevice(deviceId, hostname);

            var events = device.UncommittedEvents();

            var expectedEvent = new NetworkDeviceCreated(deviceId, hostname);
            var actualEvent = events.First() as NetworkDeviceCreated;

            Assert.AreEqual(expectedEvent.DeviceId, actualEvent.DeviceId);
            Assert.AreEqual(expectedEvent.Hostname, actualEvent.Hostname);
        }
예제 #2
0
 public void Apply(NetworkDeviceCreated @event)
 {
     _AggregateId = @event.DeviceId;
     hostname = @event.Hostname;
 }