Пример #1
0
        public void CanUserAccessRide_WithUserNotParticipant_ReturnsFalse()
        {
            // Arrange
            const string testUser = "******";

            var ride = new RideServiceModel
            {
                Date         = DateTime.UtcNow.AddDays(-1),
                Participants = new[]
                {
                    new UserRideServiceModel
                    {
                        User = new PoolItUserServiceModel
                        {
                            UserName = "******"
                        }
                    }
                }
            };

            var ridesService = new RidesService(null, null, null, null);

            // Act
            var result = ridesService.CanUserAccessRide(ride, testUser);

            // Assert
            Assert.False(result);
        }
Пример #2
0
        public void CanUserAccessRide_WithNullUser_ReturnsFalse()
        {
            // Arrange
            var ride = new RideServiceModel
            {
                Date = DateTime.UtcNow.AddDays(-1)
            };

            var ridesService = new RidesService(null, null, null, null);

            // Act
            var result = ridesService.CanUserAccessRide(ride, null);

            // Assert
            Assert.False(result);
        }
Пример #3
0
        public void CanUserAccessRide_WithUpcomingRide_ReturnsTrue()
        {
            // Arrange
            var ride = new RideServiceModel
            {
                Date = DateTime.UtcNow.AddDays(1)
            };

            var ridesService = new RidesService(null, null, null, null);

            // Act
            var result = ridesService.CanUserAccessRide(ride, null);

            // Assert
            Assert.True(result);
        }