コード例 #1
0
        public void ShouldNullifyPropertyAttachedToAttribute()
        {
            Budget budget = new Budget();
            budget.Created = DateTime.Now;
            budget.Currency = "R";
            budget.Id = Guid.NewGuid().ToString();
            budget.Name = "Budget";
            budget.Subscriber = new Subscriber();
            budget.Total = 100f;
            budget.Updated = DateTime.Now;

            CyclicRefCleaner.Instance.ProcessObject(budget);

            Assert.IsNull(budget.Subscriber);
        }
コード例 #2
0
        public void ShouldTraverseObjectStackLookingForAttribute()
        {
            var budget = new Budget
                             {
                                 Created = DateTime.Now,
                                 Currency = "R",
                                 Id = Guid.NewGuid().ToString(),
                                 Name = "Budget",
                                 Subscriber = new Subscriber(),
                                 Total = 100f,
                                 Updated = DateTime.Now
                             };

            var response = new ServiceResponse<Budget>
                                                   {
                                                       Data = budget
                                                   };

            CyclicRefCleaner.Instance.ProcessObject(response);

            Assert.IsNull(response.Data.Subscriber);
        }
コード例 #3
0
        public void SetUp()
        {
            var service = ServiceDirectory.AnonymouseInstance().SubscriberService;

            Assert.IsNotNull(service);
            var password = "******" + new Random().Next();

            var request = new ServiceRequest<Subscriber>
            {
                Data = new Subscriber
                {
                    FirstName = "Test",
                    LastName = "Test",
                    Email = "Test" + new Random().Next(),
                    Password = password
                }
            };
            var response = service.CreateSubscriber(request);

            var subscriber = response.Data;
            subscriber.Password = Cryptography.GetMD5Hash(password);

            var authRequest = new ServiceRequest<Subscriber> { Data = subscriber };

            var authResponse = service.Authenticate(authRequest);
            _authToken = authResponse.Data.Password;

            IBudgetService budgetService = ServiceDirectory.Instance(_authToken).BudgetService();
            Assert.IsNotNull(service);

            var budgetRequest = new ServiceRequest<Budget>();
            budgetRequest.Data = new Budget { Name = "TestBudget" };

            ServiceResponse<Budget> budgetResponse = budgetService.CreateBudget(budgetRequest);
            _budget = budgetResponse.Data;
        }