コード例 #1
0
        public void ThenTheCompanyIsDisplayedInTheDatabaseAt(string resource)
        {
            var storedCompany    = context.Get <Company>("company");
            var retrievedCompany = new RestCall <Company>(Method.GET, context.Get <string>("url"), resource)
                                   .AddUrlParameter("id", storedCompany.id.ToString())
                                   .Data();

            retrievedCompany.Should().BeEquivalentTo(storedCompany, $"Company {storedCompany} is not the same as {retrievedCompany}");
        }
コード例 #2
0
        public void ThenTheEmployeeIsPresentInTheEmployeesList()
        {
            var storedEmployee    = context.Get <Employee>("employee");
            var retrievedEmployee = new RestCall <List <Employee> >(Method.GET, context.Get <string>("url"), "/employees")
                                    .AddHeader("Accept", "application/json")
                                    .Data()
                                    .Where(e => e.id == context.Get <Employee>("employee").id)
                                    .First();

            Console.WriteLine($"Created employee: {storedEmployee.ToString()}");
            Console.WriteLine($"Retrieved employee: {retrievedEmployee.ToString()}");
            retrievedEmployee.Should().BeEquivalentTo(storedEmployee);
        }