Esempio n. 1
0
        public async Task Create_TitleIsNull_ThrowArgumentNullException()
        {
            var sut = new ProjectSnippetRepository(_requestFactory);

            await Assert.ThrowsAsync <ArgumentNullException>(
                () => sut.Create(0, null, "fileName", "code", VisibilityLevel.Public));
        }
Esempio n. 2
0
        public async Task Create_ValidParameters_SetsCorrectResourceAndMethod()
        {
            var sut = new ProjectSnippetRepository(_requestFactory);

            await sut.Create(0, "title", "fileName", "code", VisibilityLevel.Public);

            _requestFactory.Received().Create("projects/{projectId}/snippets", Method.Post);
        }
Esempio n. 3
0
        public async Task Create_ValidParameters_AddsVisibilityLevelParameter()
        {
            const VisibilityLevel expected = VisibilityLevel.Public;
            var sut = new ProjectSnippetRepository(_requestFactory);

            await sut.Create(0, "title", "fileName", "code", expected);

            _request.Received().AddParameter("visibility_level", expected);
        }
Esempio n. 4
0
        public async Task Create_ValidParameters_AddsTitleParameter()
        {
            const string expected = "title";
            var          sut      = new ProjectSnippetRepository(_requestFactory);

            await sut.Create(0, expected, "fileName", "code", VisibilityLevel.Public);

            _request.Received().AddParameter("title", expected);
        }
Esempio n. 5
0
        public async Task Create_ValidParameters_AddsProjectIdUrlSegment()
        {
            const uint expected = 0;
            var        sut      = new ProjectSnippetRepository(_requestFactory);

            await sut.Create(expected, "title", "fileName", "code", VisibilityLevel.Public);

            _request.Received().AddUrlSegment("projectId", expected);
        }