public async Task ShouldDeleteRecord()
        {
            SetupDelete <Identity>();

            await _handler.Handle(new DeleteIdentity { Id = Guid.NewGuid() });

            RepositoryMock.VerifyAll();
        }
Exemple #2
0
        public async Task ShouldDeleteRecord()
        {
            SetupDelete <Fake>();

            await _handler.Handle(new DeleteFakeCommand { Id = Guid.NewGuid() });

            RepositoryMock.VerifyAll();
        }
Exemple #3
0
        public async Task ShouldReturnNullIfNoRecord()
        {
            SetupNull <Identity>();

            var result = await _handler.Handle(new GetIdentityById { Id = Guid.NewGuid() });

            result.Should().BeNull();
            RepositoryMock.VerifyAll();
        }
Exemple #4
0
        public async Task ShouldReturnAllQueries()
        {
            var expected = Enumerable.Range(1, 5)
                           .Select(i => new Fake {
                Id = Guid.NewGuid()
            })
                           .ToArray();

            SetupMultiple(expected);

            var result = await _handler.Handle(new GetAllFake());

            Mapper.Map <IEnumerable <Fake> >(result).Should().BeEquivalentTo(expected);
            RepositoryMock.VerifyAll();
        }
Exemple #5
0
        public async Task ShouldReturnAllQueries()
        {
            var expected = Enumerable.Range(1, 5)
                           .Select(i => new VstsProfile {
                Id = Guid.NewGuid(), Name = $"Profile {i}", Members = new[] { Guid.NewGuid() }, Repositories = new[] { Guid.NewGuid() }
            })
                           .ToArray();

            SetupMultiple(PredicateValidator, expected);

            var result = await _handler.Handle(new GetAllProfiles());

            Mapper.Map <IEnumerable <VstsProfile> >(result).Should().BeEquivalentTo(expected);
            RepositoryMock.VerifyAll();
        }
Exemple #6
0
        public async Task ShouldReturnAllQueries()
        {
            var expected = Enumerable.Range(1, 5)
                           .Select(i => new Project {
                Id = Guid.NewGuid(), Name = $"Project {i}", IsWorkItemsEnabled = true, Identity = Guid.NewGuid()
            })
                           .ToArray();

            SetupMultiple(expected);

            var result = await _handler.Handle(new GetAllProjects());

            Mapper.Map <IEnumerable <Project> >(result).Should().BeEquivalentTo(expected);
            RepositoryMock.VerifyAll();
        }
Exemple #7
0
        public async Task ShouldSaveModel()
        {
            var expected = new FakeViewModel
            {
                Id = Guid.NewGuid()
            };

            SetupCreateOrUpdate <Fake, FakeViewModel>(expected);

            await _handler.Handle(new SaveFakeCommand
            {
                Fake = expected
            });

            RepositoryMock.VerifyAll();
        }
        public async Task ShouldSaveConfiguration()
        {
            var expectedOrganization = new OrganizationViewModel
            {
                Id       = Guid.NewGuid(),
                Identity = Guid.NewGuid(),
                Name     = "Fooooo",
                Type     = "Fooooo"
            };

            SetupCreateOrUpdate <Organization, OrganizationViewModel>(expectedOrganization);

            await _handler.Handle(new SaveOrganization { Organization = expectedOrganization });

            RepositoryMock.VerifyAll();
        }
Exemple #9
0
        public async Task ShouldReturnCorrectViewModel()
        {
            var expectedIdentity = new Identity
            {
                Id             = Guid.NewGuid(),
                Name           = "Fake identity",
                Token          = "Secret token",
                ExpirationDate = DateTime.UtcNow.AddDays(30)
            };

            SetupSingle(expectedIdentity);

            var result = await _handler.Handle(new GetIdentityById { Id = expectedIdentity.Id });

            result.Should().NotBeNull();
            result.ToExpectedObject().ShouldMatch(expectedIdentity);
            RepositoryMock.VerifyAll();
        }
Exemple #10
0
        public async Task ShouldSaveIdentity()
        {
            var expectedIdentity = new IdentityViewModel
            {
                Id             = Guid.NewGuid(),
                Name           = "New identity",
                Token          = "Secret",
                ExpirationDate = DateTime.UtcNow
            };

            SetupCreateOrUpdate <Identity, IdentityViewModel>(expectedIdentity);

            await _handler.Handle(new SaveIdentity
            {
                Identity = expectedIdentity
            });

            RepositoryMock.VerifyAll();
        }