예제 #1
0
        public void RefreshTokenNotExists_Correct()
        {
            //Arrange
            var campaignDbContext = new CampaignDbContext();
            var dbService         = new ClientServiceDb(AppData.Configuration, campaignDbContext);
            var controller        = new ClientController(dbService);

            //Act
            var res = controller.RefreshToken("138c3168-2e76-463d-8665-adwqeq4211");

            //Assert
            Assert.IsNotNull(res);
            var r = (BadRequestObjectResult)res;

            Assert.True(r.StatusCode == 400);
        }
예제 #2
0
        public void  LoginExistingUser_NotCorrectData()
        {
            //Arrange
            var campaignDbContext = new CampaignDbContext();
            var dbService         = new ClientServiceDb(AppData.Configuration, campaignDbContext);
            var controller        = new ClientController(dbService);

            var res = controller.Login(new LoginRequest
            {
                Login    = "******",
                Password = "******"
            });

            //Assert
            Assert.IsNotNull(res);
            var r = (BadRequestObjectResult)res;

            Assert.True(r.StatusCode == 400);
            Assert.NotNull(r.Value);
        }
예제 #3
0
        public void CreateCampaignBuilingsNotOnTheSameStreet_Correct()
        {
            //Arrange
            var campaignDbContext = new CampaignDbContext();
            var dbService         = new ClientServiceDb(AppData.Configuration, campaignDbContext);
            var controller        = new ClientController(dbService);

            //Act
            var res = controller.CreateCampaign(new CreateCampaignRequest
            {
                IdClient            = 2,
                StartDate           = new DateTime(2020, 1, 1),
                EndDate             = new DateTime(2020, 3, 1),
                FromIdBuilding      = 3,
                ToIdBuilding        = 6,
                PricePerSquareMeter = 40
            });

            //Assert
            Assert.IsNotNull(res);
            var r = (BadRequestObjectResult)res;

            Assert.True(r.StatusCode == 400);
        }
예제 #4
0
        public void RegisterExistingUser_Correct()
        {
            //Arrange
            var campaignDbContext = new CampaignDbContext();
            var dbService         = new ClientServiceDb(AppData.Configuration, campaignDbContext);
            var controller        = new ClientController(dbService);

            //Act
            var res = controller.Register(new RegisterRequest
            {
                FirstName = "Mike",
                LastName  = "Paul",
                Email     = "*****@*****.**",
                Login     = "******",
                Password  = "******",
                Phone     = "+48041241"
            });

            //Assert
            Assert.IsNotNull(res);
            var r = (BadRequestObjectResult)res;

            Assert.True(r.StatusCode == 400);
        }