Exemplo n.º 1
0
        public async void UpsertExists()
        {
            var service     = new ParticipantService(_config);
            var participant = new Participant()
            {
                firstName = _prefix + ".UpsertDoesNotExist"
            };

            // Create a participant
            var result = await service.Upsert(participant);

            Assert.NotNull(result);
            Assert.Equal(result.matchedCount, 0);


            //Update participant
            participant.lastName = "Different";
            result = await service.Upsert(participant);

            Assert.NotNull(result);
            Assert.Equal(result.matchedCount, 1);


            //verify update
            service = new ParticipantService(_config);
            var findResult = await service.Find(p => p.firstName == participant.firstName);

            Assert.Equal(findResult.Count, 1);
            Assert.Equal(findResult[0].Id, participant.Id);
            Assert.Equal(findResult[0].lastName, "Different");
        }
Exemplo n.º 2
0
        public async void UpsertDoesNotExist()
        {
            var service     = new ParticipantService(_config);
            var participant = new Participant()
            {
                firstName = _prefix + ".UpsertDoesNotExist"
            };


            var result = await service.Upsert(participant);

            Assert.NotNull(result);
            Assert.Equal(result.matchedCount, 0);

            service = new ParticipantService(_config);
            var findResult = await service.Find(p => p.firstName == participant.firstName);

            Assert.Equal(findResult.Count, 1);
            Assert.Equal(findResult[0].Id, participant.Id);
        }