public PetsStatusManagementTest()
 {
     _petsStatusManagementService            = ServiceProvider.Instance.Resolve <IPetsStatusManagementService>();
     _accountManagementService               = ServiceProvider.Instance.Resolve <IAccountManagementService>();
     _petsStatusManagementService.RequestUri = RequestUriHelper.PetsStatusUri;
     _accountManagementService.RequestUri    = RequestUriHelper.JwtTokenUri;
     _testingStatus = TestingObjectProvider.Instance.PetsStatus;
     _token         = _accountManagementService.SignIn(TestingObjectProvider.Instance.Login).Result;
 }
示例#2
0
        public async Task <IActionResult> Delete(PetsStatus petsStatus, CancellationToken cancellationToken)
        {
            if (ModelState.IsValid)
            {
                if (await _petsStatusManagementService.DeleteStatus(petsStatus, CurrentCookiesToken, cancellationToken))
                {
                    return(Json(new { success = true }));
                }

                CheckUnexpectedErrors();
                return(PartialView(petsStatus));
            }

            return(PartialView(petsStatus));
        }
        private TestingObjectProvider()
        {
            Pet = new Pet
            {
                Id           = Guid.NewGuid().ToString(),
                Name         = "TestDog",
                Type         = PetType.Dog,
                Sex          = PetSex.Male,
                Photo        = new byte[10],
                Description  = "Dog that eats tigers",
                Address      = "Found in the jungle",
                Created      = DateTime.Now,
                LastModified = DateTime.Now
            };

            PetsStatus = new PetsStatus()
            {
                Id       = Guid.NewGuid().ToString(),
                IsPublic = true,
                Name     = "testStatusName",
                RGB      = "#fc6dff"
            };

            User = new User
            {
                FirstName   = "Mariusz",
                LastName    = "Wolonatriusz",
                Password    = "******",
                PhoneNumber = "123456789",
                Email       = "*****@*****.**",
                Roles       = new[] { UserType.Volunteer }
            };

            this.Proposal = new Proposal()
            {
                Id           = Guid.NewGuid().ToString(),
                FirstName    = "Mariusz",
                LastName     = "Wolonatriusz",
                PhoneNumber  = "123456789",
                Email        = "*****@*****.**",
                Roles        = new[] { UserType.Volunteer },
                CreationTime = DateTime.Now,
                IsRead       = false
            };

            News = new News
            {
                Id           = Guid.NewGuid().ToString(),
                Title        = "TestNews",
                Published    = DateTime.Now,
                Created      = DateTime.Now,
                LastModified = DateTime.Now,
                Contents     = "Text",
                Photo        = new byte[10],
                Type         = NewsStatus.Released
            };

            Organization = new Organization
            {
                Name    = "Test",
                Address = new Address
                {
                    ApartmentNumber = "45",
                    City            = "TestCity",
                    Country         = "TestCountry",
                    HouseNumber     = "11",
                    PostCode        = "73-220",
                    Street          = "TestStreet"
                },

                BankAccount = new BankAccount
                {
                    BankName = "TestBankName",
                    Number   = "61109010140000071219812874"
                },

                Contact = new Contact
                {
                    Email   = "*****@*****.**",
                    Fax     = "123456789",
                    Phone   = "123456789",
                    Website = "http://testwebsite.com"
                },
            };

            HowToHelpInfo = new HowToHelpInfo()
            {
                Description      = "Deskrypszyn",
                ModificationTime = DateTime.Now
            };

            JwtToken = new JwtToken()
            {
                UserId  = Guid.NewGuid().ToString(),
                Name    = "TestName",
                Surname = "TestSurname",
                Roles   = new string[] { "TestRole1" },
                Email   = "*****@*****.**",
                ExpirationDateSeconds = DateTimeOffset.UtcNow.ToUnixTimeSeconds() + 360,
                Jwt = "Token"
            };

            Login = new Login()
            {
                Email    = "*****@*****.**",
                Password = "******"
            };

            Helper = new Helper()
            {
                Name         = "Mariusz",
                Surname      = "Wolonatriusz",
                PhoneNumber  = "123456789",
                Email        = "*****@*****.**",
                Address      = "Address",
                Category     = HelperCategory.Guardian,
                Created      = DateTime.Now,
                Id           = Guid.NewGuid().ToString(),
                LastModified = DateTime.Now,
                Notes        = "notes"
            };

            Comment = new Comment()
            {
                Contents     = "Bardzo ładny piesek",
                Id           = Guid.NewGuid().ToString(),
                Created      = DateTime.Now,
                LastModified = DateTime.Now,
                State        = CommentState.Active,
                PetUuid      = Pet.Id,
                UserUuid     = User.Id
            };
        }
示例#4
0
        public async Task <bool> DeleteStatus(PetsStatus status, string token, CancellationToken cancelationToken = default(CancellationToken))
        {
            var address = $"{RequestUri}/{status.Id}";

            return(await _restService.ExecuteDeleteAction(address, token, cancelationToken));
        }
示例#5
0
        public async Task <bool> CreateStatus(PetsStatus status, string token, CancellationToken cancelationToken = default(CancellationToken))
        {
            var address = RequestUri;

            return(await _restService.ExecutePostAction(address, status, token, cancelationToken));
        }