public void CreateAndRetrieve()
        {
            var spot = GetSpotCharter();

            repository.Save(spot);

            var spot1 = repository.Get(spot.Id);

            Assert.NotNull(spot1);
            Assert.Equal(spot.Id, spot1.Id);
            Assert.Equal(spot.CharterpartyId, spot1.CharterpartyId);
            Assert.Equal(spot.CharterpartyName, spot1.CharterpartyName);
            Assert.Equal(spot.VesselId, spot1.VesselId);
            Assert.Equal(spot.VesselName, spot1.VesselName);
            Assert.NotEqual(spot.Version, spot1.Version);

            Assert.Equal(spot.Version, 0);
            Assert.NotEqual(spot1.Version, 4);
        }
Exemple #2
0
        public void TestCommandQuery()
        {
            var spot          = GetNewSpotCharterInstance();
            var messageBroker = new SpotCharterInMemoryEventSourceRepository.InProcessEventDispatcher();

            var cmdRepository = new SpotCharterInMemoryCommandRepository(messageBroker);
            ISpotCharterCommandRepository commandRepository = cmdRepository;

            SpotCharterViewModel.ISpotCharterQueryRepository queryRepository = new SpotCharterInMemoryViewRepository(messageBroker, cmdRepository);

            commandRepository.Save(spot);

            var spotView = queryRepository.GetBySpotCharterId(spot.Id);

            Assert.NotNull(spotView);
            Assert.Equal(spot.VesselId, spotView.VesselId);
            Assert.Equal(spot.Laycan, spotView.Laycan);
        }