Пример #1
0
        public void throw_error_if_creating_location_with_same_name()
        {
            var queries = new FakeLocationQueries();

            queries.Add("lulu", "test", 1);
            queries.Add("lala", "test", 1);

            Action action = () => new CreateLocation(new EventBus(new EventDispatcher(), new FakeEventStore()), queries).Execute("lala", "ok", 1);

            action.ShouldThrow <LocationAlreadyExistsException>();
        }
Пример #2
0
        public void dont_throw_error_if_updating_myself()
        {
            var queries = new FakeLocationQueries();

            queries.Add("lulu", "test", 1);
            queries.Add("lala", "test", 1);
            queries.Add("titi", "test", 1);

            var eventStore = new FakeEventStore();
            var lieuId     = Guid.NewGuid();

            eventStore.Save(new LocationCreated(lieuId, 1, "COUCOU", "osef", 1));

            new UpdateLocation(new EventBus(new EventDispatcher(), eventStore), queries).Execute(lieuId, "COUCOU", "ok", 2);

            eventStore.GetEvents(lieuId).Should().Contain(new LocationUpdated(lieuId, 0, "COUCOU", "ok", 2));
        }
Пример #3
0
        public void throw_error_if_updating_name_whith_same_name()
        {
            var queries = new FakeLocationQueries();

            queries.Add("lulu", "test", 1);
            queries.Add("lala", "test", 1);
            queries.Add("titi", "test", 1);

            var eventStore = new FakeEventStore();
            var lieuId     = Guid.NewGuid();

            eventStore.Save(new LocationCreated(lieuId, 1, "COUCOU", "osef", 1));

            Action action = () => new UpdateLocation(new EventBus(new EventDispatcher(), eventStore), queries).Execute(lieuId, "lala", "ok", 1);

            action.ShouldThrow <LocationAlreadyExistsException>();
        }