Beispiel #1
0
        public bool register(ICheckoutClient client, String teamName)
        {
            response = client.put <RegistrationResponse>("/Checkout/Team", new RegistrationRequest {
                name = teamName
            });

            return(response.Item1 == System.Net.HttpStatusCode.Created);
        }
        public void ShouldRegisterTeam()
        {
            // Arrange
            String teamName = "AnyName";
            Team   team     = new Team();

            ICheckoutClient client = A.Fake <ICheckoutClient>(x => x.Strict());

            A.CallTo(() => client.put <RegistrationResponse>("/Checkout/Team", A <RegistrationRequest> .Ignored))
            .ReturnsLazily((String path, Object req) => Tuple.Create(System.Net.HttpStatusCode.Created, new RegistrationResponse {
                acceptedName = ((RegistrationRequest)req).name
            }));

            // Act
            bool registered = team.register(client, teamName);

            // Assert
            Assert.IsTrue(registered);
            Assert.AreEqual(teamName, team.Name);
        }
        public void ShouldRetrieveRequirements()
        {
            // Arrange
            String       teamName          = "AnyName";
            String       requirementDetail = "Round 0\nWell done!";
            Requirements requirements      = new Requirements();

            ICheckoutClient client = A.Fake <ICheckoutClient>(x => x.Strict());

            A.CallTo(() => client.get <RequirementResponse>(String.Format("/Checkout/Requirements/{0}", teamName)))
            .ReturnsLazily((String path) => Tuple.Create(System.Net.HttpStatusCode.Created, new RequirementResponse {
                requirements = requirementDetail
            }));

            // Act
            bool retrieved = requirements.retrieve(client, teamName);

            // Assert
            Assert.IsTrue(retrieved);
            Assert.AreEqual(requirementDetail, requirements.Detail);
        }
        public bool retrieve(ICheckoutClient client, String teamName)
        {
            response = client.get<RequirementResponse>(String.Format("/Checkout/Requirements/{0}", teamName));

            return (response.Item1 == System.Net.HttpStatusCode.Created);
        }
Beispiel #5
0
        public bool register(ICheckoutClient client, String teamName)
        {
            response = client.put<RegistrationResponse>("/Checkout/Team", new RegistrationRequest { name = teamName });

            return (response.Item1 == System.Net.HttpStatusCode.Created);
        }
Beispiel #6
0
        public bool retrieve(ICheckoutClient client, String teamName)
        {
            response = client.get <RequirementResponse>(String.Format("/Checkout/Requirements/{0}", teamName));

            return(response.Item1 == System.Net.HttpStatusCode.Created);
        }